ctrulib sound playing example

Discussion in '3DS - Homebrew Development and Emulators' started by mashers, Oct 26, 2015.

  1. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Can anyone point me to an example of playing a sound from a file in ctrulib? The only example I can find reads the audio data from the mic and then plays it back, whereas I need to load the sound data from a file on the SD card. Thanks in advance :)
     
  2. Garcia98

    Garcia98 Hey! Listen!

    Member
    361
    188
    Sep 8, 2015
    Salamanca
  3. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Perfect - thanks buddy. Just need to work out how to convert to the bin file on the fly now so the user can just drop sound files in.
     
  4. Garcia98

    Garcia98 Hey! Listen!

    Member
    361
    188
    Sep 8, 2015
    Salamanca
    Adding support for reading a wav file is not too hard
     
  5. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Do you know of an example of this? I know nothing about the WAV file format...
     
  6. suloku

    suloku GBAtemp Advanced Fan

    Member
    866
    491
    Apr 28, 2008
    Mashers, check ctrulib's great-refactor branch since cnsd will be deprecated shortly in ctrulib.
     
  7. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Oh I didn't see that branch. Should I switch to that branch for building everything from now on? Or should I stick with the current master branch until the great-refactor is merged into master?
     
  8. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,955
    Jun 9, 2007
    Antarctica
    It's up to you, but if you like to keep up with the latest and 'greatest' (opinion-based, of course), you might want to make a separate branch of your code that's beginning to get ready for it. Some functions have different names and take different amounts of arguments with that branch.
     
  9. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Ok, thanks. I can't actually see any difference in the audio example in the great-refactor branch. It still seems to be using csnd.
     
  10. suloku

    suloku GBAtemp Advanced Fan

    Member
    866
    491
    Apr 28, 2008
    I'm not aware of how stable that branch is, dsp sound has been there for like two weeks, but I haven't messed around with it.

    I'll ask in the irc channel how stable that is, but I don't think it is if it hasn't been merged yet, or maybe they are just waiting until ctrulib is more complete.

    Edit: about audio sample, there isn't one with dsp atm.
     
    Last edited by suloku, Oct 26, 2015
  11. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Is there an example of the dsp sound? I can only find the ctrulib example.
     
  12. suloku

    suloku GBAtemp Advanced Fan

    Member
    866
    491
    Apr 28, 2008
    I don't think there is one yet.
     
  13. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,955
    Jun 9, 2007
    Antarctica
    Not yet, no.
     
  14. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Oh ok, I'll keep checking. Thanks!
     
  15. OctopusRift

    OctopusRift GBATemp's Local Octopus, Open 9am-2am. "Not Yet"

    Member
    1,460
    832
    Nov 19, 2014
    Saint Kitts and Nevis
    planning to put the homebrew theme in gridlauncher?
     
  16. mashers
    OP

    mashers Stubborn ape

    Member
    3,837
    5,156
    Jun 10, 2015
    Kongo Jungle
    Just looking into adding UI sound effects and background music :)
     
    JJTapia19, Xenosaiga and OctopusRift like this.
  17. OctopusRift

    OctopusRift GBATemp's Local Octopus, Open 9am-2am. "Not Yet"

    Member
    1,460
    832
    Nov 19, 2014
    Saint Kitts and Nevis
    noice.
     
  18. Garcia98

    Garcia98 Hey! Listen!

    Member
    361
    188
    Sep 8, 2015
    Salamanca
    LPP-3DS has implemented WAV streaming IIRC
     
  19. lolzvid

    lolzvid GBAtemp Regular

    Member
    148
    115
    Dec 26, 2014
    Brazil
    On my experience, 44100hz was too fast.

    I've changed it to 32000hz and it's now perfect ;)

    Also, you only need to save a .wav file (with the specific proprieties) as .bin.
     
    Last edited by lolzvid, Oct 27, 2015
  20. Garcia98

    Garcia98 Hey! Listen!

    Member
    361
    188
    Sep 8, 2015
    Salamanca
    Lol no