Homebrew How do i get an ogg file to play on 3ds using C coding?

  • Thread starter Thread starter LionMemess
  • Start date Start date
  • Views Views 3,421
  • Replies Replies 10

LionMemess

Member
Newcomer
Joined
Jul 28, 2018
Messages
14
Reaction score
2
Trophies
0
Age
22
XP
86
Country
United Kingdom
Help! I need to know how i can get music or sounds to play on the 3ds using homebrew apps and coding. I code in "C" not C++ or C#. Just C and i want to know how i can get an ogg file to play on the 3ds. I compile my stuff with devkitpro and i have already downloaded the ogg library, so how do i get an ogg file to play?
 
To me that looks like a more general doubt than to specifically play audio on a 3DS. Can you already code a program to play an .ogg file on your computer?

Since the 3DS has it's own system, access to the DSP is probably different to computer's in general, so you would probably need to send the audio data through some way to devkitpro. But since I never coded on consoles, I have no idea how the system works and how it's made, so maybe I'm just throwing random statements without knowing if they are true or false, regarding the 3DS.

Nevertheless, if your problem is more general like "how to I make an app that reproduces audio", take a look at the audio output method from a project I'm working on with some friends (starting from line 51). We use PortAudio to give us access to the sound card, and libsndfile to read codified sound formats. From there it's just a matter of outputting audio samples to a buffer that gets sent to the sound card for playback.
 
i hate this so much, all these trolls on this site

--------------------- MERGED ---------------------------

To me that looks like a more general doubt than to specifically play audio on a 3DS. Can you already code a program to play an .ogg file on your computer?

Since the 3DS has it's own system, access to the DSP is probably different to computer's in general, so you would probably need to send the audio data through some way to devkitpro. But since I never coded on consoles, I have no idea how the system works and how it's made, so maybe I'm just throwing random statements without knowing if they are true or false, regarding the 3DS.

Nevertheless, if your problem is more general like "how to I make an app that reproduces audio", take a look at the audio output method from a project I'm working on with some friends (starting from line 51). We use PortAudio to give us access to the sound card, and libsndfile to read codified sound formats. From there it's just a matter of outputting audio samples to a buffer that gets sent to the sound card for playback.

thank god

--------------------- MERGED ---------------------------

To me that looks like a more general doubt than to specifically play audio on a 3DS. Can you already code a program to play an .ogg file on your computer?

Since the 3DS has it's own system, access to the DSP is probably different to computer's in general, so you would probably need to send the audio data through some way to devkitpro. But since I never coded on consoles, I have no idea how the system works and how it's made, so maybe I'm just throwing random statements without knowing if they are true or false, regarding the 3DS.

Nevertheless, if your problem is more general like "how to I make an app that reproduces audio", take a look at the audio output method from a project I'm working on with some friends (starting from line 51). We use PortAudio to give us access to the sound card, and libsndfile to read codified sound formats. From there it's just a matter of outputting audio samples to a buffer that gets sent to the sound card for playback.

thank you so much

--------------------- MERGED ---------------------------

To me that looks like a more general doubt than to specifically play audio on a 3DS. Can you already code a program to play an .ogg file on your computer?

Since the 3DS has it's own system, access to the DSP is probably different to computer's in general, so you would probably need to send the audio data through some way to devkitpro. But since I never coded on consoles, I have no idea how the system works and how it's made, so maybe I'm just throwing random statements without knowing if they are true or false, regarding the 3DS.

Nevertheless, if your problem is more general like "how to I make an app that reproduces audio", take a look at the audio output method from a project I'm working on with some friends (starting from line 51). We use PortAudio to give us access to the sound card, and libsndfile to read codified sound formats. From there it's just a matter of outputting audio samples to a buffer that gets sent to the sound card for playback.


HEY I ASKED FOR "C" NOT C++ >:(
 
  • Like
Reactions: Ev1lbl0w
HEY I ASKED FOR "C" NOT C++ >:(

This is a way to do what you want to achieve, not a copy/paste method that will magically solve all your problems. The objective is for you to see how is the audio being read and sent to the sound card in our case. The implementation of this is, of course, up to you.
 
This is a way to do what you want to achieve, not a copy/paste method that will magically solve all your problems. The objective is for you to see how is the audio being read and sent to the sound card in our case. The implementation of this is, of course, up to you.


hmmmmmmmmmmmmmmmmm. ok.

i actually had a ndsp example that uses fopen and stuff.

i dont know if i can alter that or something

so the way audio is being read... hm...

--------------------- MERGED ---------------------------

hmmmmmmmmmmmmmmmmm. ok.

i actually had a ndsp example that uses fopen and stuff.

i dont know if i can alter that or something

so the way audio is being read... hm...

i dont get it, why do i have to understand the fact that its reading frames of a music file. i just wanted to play an ogg file on a 3ds. i mean. how. how do you read an ogg file or how do u make it play on a 3ds it doesnt make sense anymore

--------------------- MERGED ---------------------------

hmmmmmmmmmmmmmmmmm. ok.

i actually had a ndsp example that uses fopen and stuff.

i dont know if i can alter that or something

so the way audio is being read... hm...

--------------------- MERGED ---------------------------



i dont get it, why do i have to understand the fact that its reading frames of a music file. i just wanted to play an ogg file on a 3ds. i mean. how. how do you read an ogg file or how do u make it play on a 3ds it doesnt make sense anymore

did i download that ogg library for nothing
 
i dont get it, why do i have to understand the fact that its reading frames of a music file. i just wanted to play an ogg file on a 3ds. i mean. how. how do you read an ogg file or how do u make it play on a 3ds it doesnt make sense anymore

"Playing an audio file" is basically:

- Decodifying the audio file (in your case it's an .ogg file)
- Reading the audio data
- Sending the data to the sound card to reproduce it

If you have a library that already does this heavy-lifting part for you, it should be as simple as "giving it the filename and calling play()". As I said above, I have no experience with developing homebrew for the 3DS, so devkitpro may or may not already have a method to play audio files. I'm just presenting a way to read audio files on a computer so you understand more of what's happening when you "play an audio file" and thus learn what do you need to know so you can do that on the 3DS if there isn't already a library that will do that for you.

did i download that ogg library for nothing

If you gave more info on what software you're using, maybe I could give you a documentation page to help more specifically.

--------------------- MERGED ---------------------------

Also a quick google search help may already help you in 99% of the cases.
 
Decode into buffer with libvorbis and libvorbisfile. Tutorial
Play with ndsp. Example

Rinnegatamante's sound code
My sound code. (Probably not as good as Rinne's, but it's more simple.)
More complicated example. This doesn't use libvorbisfile, just vorbisidec.

Recent discussion about playing sound in the homebrew development thread.

If you want to use libvorbisfile, there's no precompiled fixed point version on devkitPro Pacman, so you'll need to use the normal version and compile everything with "-mfloat-abi=softfp".

(Note: Not posting this for OP, he doesn't even know how to use a keyboard. Posting for anybody who finds this thread with Google months later.)
 
Last edited by ,

Site & Scene News

Popular threads in this forum