LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Importing waveforms from a PC to SB

Root / Submissions / [.]

PerskaCreated:
List of sections

Before Starting

Before staring, make sure you have the following: SmileBASIC File Manager Wav Recorder A audio managing tool. (I used Audacity for this tutorial) A PC with Windows installed on it. (you may be able to use Mono on Linux to run this but IDK) Download the WAV2SBWAV tool from here.

Preparing your audio file

Open your audio file in Audacity, and first, set the sample rate to 8180. (there is no option for 8180 but you can write it there manually) Next, make the audio track mono via Tracks->Stereo Track to Mono. Finally, select File->Export Audio. On the save dialog, set the save format to be Other uncompressed formats and then select Options. Set the settings to be WAV (Microsoft) and Unsigned 8-Bit PCM. Now save the new file as anything.

Exporting audio to SmileBASIC format

Open the WAV2SBWAV tool. Select Load WAV and then select the file made earlier. (if the WAV file's length is over 30s, tick Ignore sample count) After it's done writing the data, select Save SBWAV and save it anywhere you want to. To see how to import the file to SB, see this. Make sure the filename starts with B and is UPPERCASE

Known bugs(?) of the tool:

  • The tool apparently overwrites the footer a bit, but that really shouldn't be a problem.
  • The date is totally wrong. I might change it to use the current time & date.
  • Ticking "Ignore sample count" makes it also ignore the sample rate. I haven't tested yet what happens when you play a file like that, but I don't think it'll make the wavplayer library explode/freak out/fly to space.

Should've mentioned this too: if the WAV file is over 30s, it won't play normally on the wavplayer. You can go around this by making it use integers instead of floats. While this does not remove the limit fully, it gives extra memory for more audio or your whatever variables. You can always split the waveform too.

Works really well! Good job!

Nice! I've wanted a good way to transfer audio from my PC, this looks like it will work great!

Good job, exactly what I've been looking for!

Hold on, I didn't realize this required homebrew... Would it be possible to use P/SEND (http://myu314.org/studyroom/product/pisend2/) to transfer the output file into SmileBASIC?

Replying to:mystman12
Hold on, I didn't realize this required homebrew... Would it be possible to use P/SEND (http://myu314.org/studyroom/product/pisend2/) to transfer the output file into SmileBASIC?
I don't know. Maybe you can use Petit Modem with this if you do some modifications to the code to save the output file to the format it uses?

Replying to:Perska
Should've mentioned this too: if the WAV file is over 30s, it won't play normally on the wavplayer. You can go around this by making it use integers instead of floats. While this does not remove the limit fully, it gives extra memory for more audio or your whatever variables. You can always split the waveform too.
How exactly would I make it "use integers instead of floats"? I know what they both mean, I just don't know exactly what I'm changing...

Replying to:Perska
Should've mentioned this too: if the WAV file is over 30s, it won't play normally on the wavplayer. You can go around this by making it use integers instead of floats. While this does not remove the limit fully, it gives extra memory for more audio or your whatever variables. You can always split the waveform too.
You can add OPTION DEFINT to the wavplayer library which defaults every variable without a suffix to be treated as a integer. You also should load the wav file in your program to a int array.
DIM ARRAY%[0]
LOAD "DAT:MYWAV.WAV",ARRAY%,0
(or you could use the WAVSTART command, too!)

Replying to:Perska
Should've mentioned this too: if the WAV file is over 30s, it won't play normally on the wavplayer. You can go around this by making it use integers instead of floats. While this does not remove the limit fully, it gives extra memory for more audio or your whatever variables. You can always split the waveform too.
So If all my audio is doing is static-ing for a second before jumping to a high pitch whine, then fading away, I didn't create the file right? :P

thank you JKNXD3QV

Please add tags such as "WAV2SBWAV" , so we can find it more easily.

Replying to:12Me21
Please add tags such as "WAV2SBWAV" , so we can find it more easily.
"wav2sbwav" is already there. What kind of other tags there should be?

Is the SBWAV file what I'm supposed to send through Petit Modem? Please enlighten me or something, I'd like to send WAV files with Petit Modem.

Replying to:Sam
Is the SBWAV file what I'm supposed to send through Petit Modem? Please enlighten me or something, I'd like to send WAV files with Petit Modem.
The program generates a file to be sent with homebrew, as I have no idea what the format that Petit Modem uses is. If I figure out the format, I could simply make it compatitle with Petit Modem.

Replying to:Sam
Is the SBWAV file what I'm supposed to send through Petit Modem? Please enlighten me or something, I'd like to send WAV files with Petit Modem.
convert to text file perhaps? That's what I did to send image files.

The song became.. very disturbing in my opinion.. Awesome! It made me remember how slowing songs down gives them new meaning~? Why.. does Audacity keep saving it as an AIFF..
SpoilerUNDERTALE does it a few times which I think is cool, too.

Replying to:12Me21
Please add tags such as "WAV2SBWAV" , so we can find it more easily.
WAV SBWAV

Replying to:Sam
Is the SBWAV file what I'm supposed to send through Petit Modem? Please enlighten me or something, I'd like to send WAV files with Petit Modem.
Petit modem can convert the following as of this moment : BMP/PNG/GIF/JPG into a .PZG file, TXT into .PZT file, and DAT into .PDA It cannot convert any other file, but you can send it raw without conversion... just convert into a wav file for petit modem simplex receiver to use...

It won't let me change the rate to 8180

Replying to:Midnoclose
It won't let me change the rate to 8180
You have to type the 1 on the number pad for some reason.