Open atesin opened 1 year ago
You don't really have much storage for something like a WAV file...
https://github.com/nesbox/TIC-80/wiki/RAM#sound-registers
You can update the Sound Registers every tick (60 times per second) to generate sound independently from the built-in API functions.
So with custom programming you could have 1.92khz (60*32), 4 bit audio... at the cost of like 1kb of storage per second... perhaps enough for like a few very specific and distorted sound effects...? Or if you gave up MAP you could store 32 seconds of audio or so... maybe like if you had an audio "cut scene" paired with a graphic? But you'll burn thru that storage fast...
i dont know tic80 internals, but i doubt it stores raw wave data in memory, like you i think it would consume a lot of memory.... but i think instead, it stores some points needed to "draw" the wave, and those are the dots you see when you "draw" the wave in sfx editor and tic80 read and interprets when sounds are played
i would like to know if could be have ANY way of import some sound inside tic80, not only by store wav data directly but also could be a reader/analyzer that parses a .wav file and tell tic80 what points to plot in sfx editor...
a sound copy/paste function would be terrific, or a wav file importer/analyzer command or external tool would be great also... it would greatly improve que quality of our sfxs/songs
but i doubt it stores raw wave data in memory,
Well, it doesn't really store "raw wav data" at all - or rather it has no where specific to store such data... you could encode it into your program source, or store it in your cartridge... but to play it you have to use the facilities that TIC-80 gives you sound wise - which [most directly] are the sound registers... 32 samples of 4-bit audio that you'd have to make last 1/60 of a second... you'd have to constantly fill each frame from whereever you had the WAV data stored.
i would like to know if could be have ANY way of import some sound inside tic80,
Sure. Just downsample to 1.92kb 4-bit audio, store it in the cartridge RAM, and then write a program to read it and shove it into the sound register every frame. It would be a pretty cool demo actually.
My worry would be timing issues, that TIC-80 isn't really designed/tested to work this way and you might do all that work just to find out you have clicks or dropped audio or other strange issues... but maybe it "just works"...
I think something like https://sox.sourceforge.net/sox.html could get you close to the raw data you'd need... output a mono 4-bit 1.92khz raw file... the you'd just need a small script to convert that raw file into textual binary data (the same way TIC-80 saves such data in text mode)... then you just need to write the audio processing code. :-)
sox input.mp3 -b8 -c1 -r1920 -eunsigned-integer out.raw
Doesn't seem to want to write 4-bit so you'd have to also convert the 8-bit samples to 4-bit, easy enough. Doesn't sound great already though, you'd probably want to specially process the audio for such tight encoding, not just convert it "as is".
Ok, sox is amazing and if you knew what you needed it could probably do any type of post-processing you needed to try and clean the audio up...
a wav file importer/analyzer command
This is unlikely since there is really no way to use that data without a lot of custom programming. Importing a MIDI would honestly make way more sense, etc... https://github.com/wojciech-graj/TIC-MIDI
i agree with you about midi... but midi are just song patterns without any actual sound wave
for example to make music, i have no idea how to create bassdrum kick or claps or cymbal sounds, or how "looks" a violin or trumpet or any other "real world" sound... i can't imagine how sounds are "seen" graphically to replicate it :(
i would like if we could sample some sounds in some ecternal editor tool like audacity, audition, soundforge, etc... process it, stretch to required freq/lenght, downsampling, export to wav.... then run a tool to read wav files, parses and put data in a .cart directly
that wav file parser+importer would be a very powerful and useful tool, we could just use all the power of some external sound editor, we could put very rich sounds inside tic80
hi... the documentation is very swallow...
I agree!
Well, it doesn't really store "raw wav data" at all
I'm fairly certain that it does, at offset 0xFFE4 (see wiki). It's just not the entire song is stores as wave, only the instruments (which then is put together into a whole song using the tracker).
but midi are just song patterns without any actual sound wave
That's for the tracker. The tracker contains song patterns, not waves either.
for example to make music, i have no idea how to create bassdrum kick or claps or cymbal sounds, or how "looks" a violin or trumpet or any other "real world" sound... i can't imagine how sounds are "seen" graphically to replicate it :(
If you're familiar with old-school trackers (FT2, OpenMPT, MilkyTracker etc.), then those work similarly like TIC-80: they have a few instruments, stored as waves, and MIDI-like patterns with musical notes. You can load a .mod file with a trumpet or violin for example and see the waveform in those trackers. However .mod files have 8-bit or 16-bit samples, and one instrument might have up to 65536 samples. On TIC-80, one sample is stored on 4-bit, and you have only 32 samples, but despite the limited precision the wave must look the same to give the same sound.
Another approach try using Audacity. Load a violin wave for example which is 1 second long, then on the bottom left enter "32 Hz" (this only works if the length of the sample is 1 sec). The resulting waveform should then look like exactly like the one you have to set in TIC-80 for a similar sound.
I'd like to point out that violin has probably one of the most complex waveform with lots of harmonics. It is highly unlikely that you'll be able to reproduce it using chip-tunes. But at least, using the methods above, you'll see how the sound's wave should look like.
Hope this helps, bzt
run a tool to read wav files, parses and put data in a .cart directly
Ah, about that, it won't work. You might be able to use wav files for the waveforms only, and not for the entire song as stored in the .cart.
(Maybe if the song is simple, then you can locate the individual instrument wave in that, and using sophisticated 1-d pattern matching algorithms or maybe AI you can convert that into a list of musical notes required for the tracker. But it is highly unlikely that you can do this with complex songs where multiple instruments are played at once, specially when the same instrument playing multiple notes at the same time.)
Here's a good explanation why is it impossible what you ask (talks about MIDI, but the same stands for any tracker, TIC-80 patterns included).
Cheers, bzt
If you're familiar with old-school trackers (FT2, OpenMPT, MilkyTracker etc.), then those work similarly like TIC-80
yes, but they do read and import .wav files as instruments, while tic80 dont
Another approach try using Audacity. Load a violin wave for example which is 1 second long, then on the bottom left enter "32 Hz" (this only works if the length of the sample is 1 sec). The resulting waveform should then look like exactly like the one you have to set in TIC-80 for a similar sound.
NICE HINT!
run a tool to read wav files, parses and put data in a .cart directly
Ah, about that, it won't work. You might be able to use wav files for the waveforms only, and not for the entire song as stored in the .cart.
hi.... i never talked about importing an entire .wav song inside a cart, that is unlikely... but about putting sound samples in sfx editor wave slots instead
i would like a tool to get some .wav SAMPLES of about 1 second, fixed frequency, etc.. and make it appear inside tic80 sfx editor wave slots (obviously with lower quality)..... that way we can get some samples from outside and make nice songs or sfx's in tic80
about putting sound samples in sfx editor wave slots instead
TBH I got so frustrated not getting answers to my TIC-80 audio questions for months that I wrote my own fantasy console in the meantime... It can import / export Amiga MOD (.mod) tracker files and General MIDI (.mid) music sheets too (for the latter there are some built-in wave samples or you can import .wav files directly). To see it in action click here (just drag'n'drop the "demo floppy" to the floppy drive, and the music will start).
i would like a tool to get some .wav SAMPLES of about 1 second, fixed frequency, etc..
The soundbank for the built-in waves for my fantasy console is here. It is in Amiga MOD format, but all you need is the samples in that file. Has 2 instruments per General MIDI family, each approx. 1 sec long, max 16k samples, all tuned to C-4 (except the violin, that's tuned to G-4). It is exactly what you asked for, but you'll need some work to scale these down to TIC-80 waves.
Oh, one more thing, these samples are licensed under GPL.
Hope this helps, bzt
I'm fairly certain that it does, at offset 0xFFE4 (see wiki).
Yes, if we're being quite technical... :-) but that (at a very slow cadence) is only 1/60 a second of wave data... there is no where clear to just import a 20 second (or even 1 second) wav data - which is what this user is requesting when they say "wav data"... they mean a few seconds (at least), not a 1/60s waveform.
i would like a tool to get some .wav SAMPLES of about 1 second
The TIC-80 "samples" (waveforms) are 1/60 a second. So a full second would require 60 samples, but we have only 16. So you're back to trying to copy things in and out of the audio registers if you want like 1 second samples.
You might first try downsampling your content to 2.1khz and see if you're even happy with the result... it sounds pretty awful. (I tried a whole song)
@joshgoebel : see the 16 waveform slots at sfx editor?
well... i wish some tool to import external waveforms to THAT slots, whatever the duration or quality they have ..... i never had talked about a 20secs song or whatever... you are making too many wrong asumptions about i said
if waveforms at sfx editor stores 1/60 second, then the .wav samples to import should have 1/60 second.... no problem
i hope i had talked clearly enough... i am thinking in something like, for example:
> import sfx woof.wav id=11
I think you're not imagining how short 1/60 of a second is... π you couldn't put "woof" in there, but perhaps just part of a very rough w
or o
sound...
And I think my suggestion of sox is about as close as you're going to get...
sox
gets you the raw data in 8-bit binary form (ie wav or mp3 => raw 8-bit)ChatGPT could probably even help you with those last two. :)
Oops, forgot the 4-bit encoding:
file = File.open("binary_file", "rb") # open the binary file in read-binary mode
bytes = file.read.bytes # read the bytes from the file
if bytes.length.odd? # pad the last byte with zeros if there are an odd number of bytes
bytes.push(0)
end
output_bytes = bytes.each_slice(2).map do |slice| # group the input bytes into pairs and process them
(slice[0] & 0xF0) | ((slice[1] >> 4) & 0x0F) # squeeze the pair of bytes into a single byte
end
hex_chars = output_bytes.map { |b| "%02X" % b }.join(" ") # convert the output bytes to hex-encoded characters
puts hex_chars # print the resulting hex-encoded string
If someone can come up with a sox
conversion of a popular mp3 that doesn't sound like garbage (ie the correct post-processing to clean up the audio for such tiny-ness) I might be persuaded to write the inside TIC-80 code needed for play the audio stream using the audio registers... and show how such a thing should be done... I was using "build me up buttercup" and it was pretty bad even in 8-bit, 2.1khz...
sox gets you the raw data in 8-bit binary form (ie wav or mp3 => raw 8-bit)
Wav is also just raw binary data, just with a little header (here is a description). I think .wav is a much better choice because it's more widespread than sox.
If someone can come up with a sox conversion of a popular mp3 that doesn't sound like garbage
That's quite a challenge. I think it would be better imho just let third party tools do the conversion (like Audacity), and only provide loading in TIC-80. Much simpler and easier to implement (all you have to do is then downscaling 8-bit or 16-bit samples to 4-bit, which is essentially is simple as taking the most significant 4-bits and that's it.)
import sfx woof.wav id=11
I like this version, clear and straightforward. But @joshgoebel is right, the wav file should have only 32 samples for this to work, which isn't much. (But at least this command would allow importing properly prepared waveforms from third party software like Audacity.)
Cheers, bzt
I think .wav is a much better choice
Apples and oranges. sox
is a popular audio command line utility (link earlier in thread)... it can take tons of different audio files and provide simple raw output.
I think it would be better imho just let third party tools
Yes... sox
is such a tool... but it has 100 options for low pass filters, gain, volume, etc... surely some of them can improve the quality of low bit rate audio, for example I had some luck with normalizing and turning up the gain...
I'm still curious about writing a test cart to play a whole song... and see how well that might (or might not) work... I think with the right music choice it might be useful for like 30s graphical cut-scenes in a game with audio (not chiptunes).
I think you're not imagining how short 1/60 of a second is...
you are making too many wrong asumptions about i said
yes of course i know.... is a single cycle at 60hz, or 2 at 120hz, 3 at 180hz... or 10 at 600 hz, etc ...about 17ms, like the duration of a clap, but enough for the human ear to distinguish a clap from a hit or a crash or a blow or other short sound.... anyway, tic80 plays the samples in loop so the sound is perceived longer and more distinguishable
additionally.. if you process a bark sound externally, downsample and cut at 17ms then import into tic80 soundwave bank someway... then in tic80 you can process it with ENVELOPES (and tracker commands if composing a song)... chances are you could achieve a distorted but very recognizable "woof" sound
envelopes:
please dont expand this conversation furthermore in soundwaves duration, and focus in how to achieve the requested
with a tool like this, we could even sample some human voices and import them into tic80... then create some instruments using this wave, with different envelopes, to simulate NPC characters speaking in an RPG game ... speaking nonsensical words of course, but through this we could give them some sort of "personality", like in hollow knight
a tool like this will open many posibilities
I've given you all the pieces you need to import the audio data.
sox
to get a 8-bit raw data file (sox input.wav -b8 -c1 -r1920 -eunsigned-integer output.raw
)new lua; save cart.lua
, etc)I have no suggestions for playing with the right side of the audio stuff...
we could even sample some human voices and import them into tic80.
You could, but human vocals really require higher frequencies than TIC-80 supports... ideally 8-16khz... which I assume is why I've been struggling to get good results at only 2khz.
There is some question about whether maybe you could string multiple 'sfx' together though - and if the sound 'hardware' would give you better output than you can get driving it by hand... for example if you could load ALL 16 WAVEFORMS with sequential audio data... then play a "melody" very fast that is just WAVE 1, WAVE 2, WAVE 3, WAVE 4, etc... (with the timing end perfectly on the 1/60 boundary)... then you'd have 32khz audio.
Of course you'd never want to sample that highly (RAM)... but that's just the "how" you might go about it... in my testing even 4khz was like 10x better sounding audio than 2khz. And that would only require 2 back to back waveforms/sfx.
but human vocals really require higher frequencies than TIC-80 supports... ideally 8-16khz... which I assume is why I've been struggling to get good results at only 2khz
chances are you could achieve a distorted but very recognizable "woof" sound
i say "distorted" .... i know...... anyway if somebody feels creative and need a little more quality, he/she could sample the sound at lower freq and play at higher one.. for human voice is ok because is very unlikely somebody normally speak at 5th octave
please stop of misinterpreting me and putting me obstacles.... i feel like it i would like to run and you are putting me stones in my path..... focus
i am not a programmer.. that is because the "[request]" label on the issue title ... i hope somebody with the needed skill and experience will feel motivated and write a tool like this ... or if the official tic80 team add this function in later releases, even better!
- run that thru the Ruby script to get the 4-bit encoded data TIC-80 wants
that means we must install ruby just to use this??... wont be better an .exe file?... or a java one at least? ... chances are we already have java installed ... or python at least
I'm just being realistic and setting expectations. I doubt we'd ever build in a wav importer because I don't think importing 1/60s wavs into waveforms is a useful thing for most people. What you want for a "mod file" like experience is much longer audio samples of real instructions, and TIC-80 4-bit 32 sample WAVEFORMS are not really an equivalent of that (IMHO). They are really intended for drawing different audio "shapes" (square wave, triangle wave, etc)...
I'm super curious if/when you (or someone) manages to import "woof" into a 1/60s WAVEFORM what it's going to sound like... my bet is not at all what you think.
Definitely some cool ideas for an external tool though and again as I said I've pretty much laid out exactly how you (or someone else) would go about doing it - and given you all the tools necessary.
Prove me wrong and I'll be amazed and eat humble pie. :-)
that means we must install ruby just to use this??.
Ruby is just what I know so I could eyeball the code as correct... Ruby is pretty easy to install in the *nix/Mac world (if it's not already present) - I have no idea about Windows, sorry. As I said you could ask ChatGPT to write it for you in a different language, but yes then you might need to be a programmer to read it and compile it to an EXE, etc... Ruby is nice because it's a scripting language, no compiler needed, just the runtime.
I use homebrew on Mac and it took only 5 seconds to install sox
with brew install sox
... it's probably(?) possible to install on Windows as well, but I dunno the steps.
edit: i shrinked the text a little
What you want for a "mod file" like experience is much longer audio samples of real instructions
we must install
Well, maybe... I've been writing all this for the benefit of anyone reading this (not just you)... it's possible someone else might want to take a whack at this who already has all these things installed or is on a platform that makes them super easy to access (like Linux/Mac). Maybe they are even super easy to access on Windows, I dunno - you'd have to go look.
Someone else is definitely free to jump in here and suggest alternatives for Windows that might be more accessible to Windows users....
I'm pretty sure earlier you conflated samples (like recorded instruments) with TIC-80 waveforms... that's where my modfile comment came from (since modfiles have REAL sampled instruments, not just waveforms)... you have my apologies if I misunderstood.
WITHOUT TOO MUCH HANDWORK OF TRIAL+ERROR
No need to yell. Well if you're lucky someone else will come along and do all the hard work. π½ Hopefully I've given that person a few breadcrumbs to make their work easier. π
So far I've had 0 luck getting two waveforms to "merge" (ie, one play right after the other) regardless of what tempo/speed settings I use in the music editor... if this (wave 0 + 1) was played properly back to back it should sound like a single wave, without a glitch every time the waveform switches.
But no, you can hear a click every time the waveform changes.
haha.... nice try xD (until not what i am pursuing though) .... i remember fasttracker2 had a nice feature in instrument editor that was "pinpong loop", that causes sfx loop bounces forward and backward between set boundaries
... moving to another topic.... have you ever heard of or play "draconus" .. is a bestselling atari 8-bit game, i burnt my eyes many times and lost some weight playing draconus when i was a kid :) .... and his music was terrific!!
i tried to remake its intro+music in this cart = http://tic80.com/play?cart=3293
until i think it resulted pretty good, i had some hardwork and problems trying to mimicking some original sounds.... i wish i had a tool like requested to make the sounds more faithful to original :)
... have you ever heard of or play "draconus" .. is a bestselling atari 8-bit game,
No, but the music sounds pretty sweet!
Sadly driving the audio each frame also doesn't seem to work:
-- script: lua
t=0
function TIC()
cls(13)
t=t+1
freq = 600
poke(0xff9c, freq & 0xff)
poke(0xff9c+1, 0xf0 | (freq >> 8))
if t%2 == 0 then
for i = 0,15 do
poke(0xFF9C+2+i, ((i <<4) | i))
end
else
v = 0
for i = 15,0,-1 do
poke(0xFF9C+2+i, ((v<<4) | v))
v = v + 1
end
end
for x = 0, 15 do
print(x, x*15, 50)
print(peek(0xFF9C +2 +x), x*20, 60 + (10 * (t%2)))
end
if false then
poke(0xff9c+2+0, 0x01)
poke(0xff9c+2+1, 0x23)
poke(0xff9c+2+2, 0x45)
poke(0xff9c+2+3, 0x67)
poke(0xff9c+2+4, 0x89)
poke(0xff9c+2+5, 0xab)
poke(0xff9c+2+6, 0xcd)
poke(0xff9c+2+7, 0xef)
poke(0xff9c+2+8, 0xef)
poke(0xff9c+2+9, 0xcd)
poke(0xff9c+2+10, 0xab)
poke(0xff9c+2+11, 0x89)
poke(0xff9c+2+12, 0x67)
poke(0xff9c+2+13, 0x45)
poke(0xff9c+2+14, 0x23)
poke(0xff9c+2+15, 0x01)
end
end
The single wave at the end sounds much better to me than the two phase one we're swapping every frame.
I think .wav is a much better choice
Apples and oranges. sox is a popular audio command line utility
No. Neither of the tools the OP mentioned knows this obscure sox
format, but they all know wav
format. So it's not a question of choice, one is supported, the other isn't. Besides, Audacity has far superior filters and conversion features than this sox tool (not to mention the lot more user friendly interface).
I doubt we'd ever build in a wav importer because I don't think importing 1/60s wavs into waveforms is a useful thing for most people.
Here it is. Extremely simple, ca. 20 SLoC because .wav files are just raw PCM data. And it would be definitely useful to lots of users (the OP and me included).
/**
* Load .wav file into a sound effect waveform
* @param cart cartridge
* @param bank bank to load to (0 - 7)
* @param sfx sound effect to load to (0 - 15)
* @param wavbuf memory buffer with .wav data
* @param wavsiz length of the .wav buffer
*/
void tic_load_wav(tic_cartridge* cart, int bank, int sfx, const u8* wavbuf, s32 wavsiz)
{
/* check input parameters */
if(cart && bank >= 0 && bank < 8 && sfx >= 0 && sfx < WAVES_COUNT &&
wavbuff && wavsiz > 20 && wavsiz < 65536 &&
/* check RIFF WAVE format */
!memcmp(wavbuff, "RIFF", 4) && !memcmp(wavbuf + 8, "WAVE", 4) &&
!memcmp(wavbuf + 12, "DATA", 4) && /* magic bytes */
wavbuf[20] == 1 /* data format */ && wavbuf[22] == 1 /* number of channels, mono */) {
/* parse .wav header */
int i, numsamples = (int)((wavbuf[29]<<8)|wavbuf[28])/(int)(buf[34]>>3);
u8 *src = (u8*)wavbuf + 20, *dst = cart->banks[bank].sfx.waveforms.items[sfx].data, data;
/* we have only place for 32 samples in TIC-80 */
if(numsamples > 32) numsamples = 32;
/* get raw .wav data */
memset(dst, 0, 16);
for(i = 0; i < numsamples; i++) {
switch(wavbuf[34]) {
case 8: data = *src++; break; /* 8-bit PCM */
case 16: src++; data = *src++; break; /* 16-bit PCM */
case 24: src += 2; data = *src++; break; /* 24-bit PCM */
}
dst[i / 2] |= (i & 1 ? data & 0xF0 : data >> 4);/* save to 4-bit TIC-80 waveform */
}
}
}
(Of course this is just the core, one have to add an "import sfx" command too which calls this function.)
I DON'T WANT A "MOD FILE" EXPERIENCE NOR IMPORT LONG SAMPLES, I AM NOT A FOOL.... I HAD WORKED WITH AUDIO BEFORE.... I HAD WORKED WITH CONSTRAINED PLATFORMS LIKE REAL ATARIS
If you change your mind, just give a try to MEG-4. That can actually import mod files and longer samples out-of-the-box. It will do all the necessary conversions from Amiga MOD format to the MEG-4 DSP chip format automatically and transparently ;-)
BTW, have you had any luck converting the samples I told you about into TIC-80 format? I know, .mod not ideal in this case, but having all those samples in one place is definitely a good start. FastTracker 2 (ft2-clone) can extract the samples easily into .wav files, and Audacity can convert Hz.
Cheers, bzt
I've put together a simple .wav to .tic converter, and since I don't know your OS, I've compiled it under Linux and Windows as well. Has no dependencies, CC-0 licensed (public domain), and source included.
It supports mono and stereo .wav files, with unsinged 8-bit, signed 8-bit, 16-bit, 24-bit and 32-bit floating point samples. To convert multiple .wav files, simply add more on the command line. The first .wav file will become the first TIC-80 waveform, the 2nd the 2nd etc. It does not do HZ conversion or anything fancy, it just reads the first 32 samples from the .wav files for each TIC-80 wave (so use properly converted .wav). It outputs output.tic, which then can be loaded in TIC-80.
I only did basic tests, if you have any issues, let me know and I'll fix.
Hope this helps, bzt
knows this obscure sox format, but they all know wav format.
Again, It's a tool, not a format.
Audacity has far superior filters and conversion features than this sox tool
Perhaps, though all I see here is a claim, not any evidence to that effect. π CLI software can be just as powerful and capable as GUI for those who know how to use it. Just because you've never heard of it doesn't make it crap. :-)
It makes no sense to add yet another tool and further dependencies into the toolchain if Audacity is already there and can perfectly do the job.
Specially since the OP isn't familiar with sox, furthermore he named Audacity explicitly as a preferred tool (and Audacity can export raw (header-less) PCM in the first place, no need to use sox for that).
FYI, if the OP would have asked about a tool that can be used in batch files then that would be a different matter, but I still wouldn't recommend using arbitrary raw binary data. Sticking to well-known formats like .wav always pays off on the long run.
CLI software can be just as powerful and capable as GUI for those who know how to use it.
Never said otherwise. I prefer CLI tools myself (check out my repos, I've created numerous CLI tools, see PICO-8 to TIC-80 for example), but 99% of the average users don't know nor like CLI, all they know is GUI (that's why I made a browser version too of PICO-8 to TIC-80).
Look, I've provided the C code to load .wav files directly and which could be merged into TIC-80, and also provided a separate tool to convert .wav files into a .tic file without any dependencies (no ruby, no libs. no installation etc. needed, it just worksβ’). What else could I add?
Cheers, bzt
Neither of the tools the OP mentioned knows this obscure
sox
about audacity: (not to mention the lot more user friendly interface)
i agree with @bztsrc in all those statements
i never heard of sox before.... and editing a sound file by command line would be like trying to edit an image file by command line with gd or imagemagick cli instead gimp, paint.net, photoshop, corel or even mspaint (i have paint.net and mspaint installed)
why sox?, if i had audacity installed?, is free software, freely downloadable and usable, short comparatively, available in all major OS's, modular, easy, nice, powerful, etc
.. but one thing sox could serve is to look at its source code (for who knows c/c++) and get ideas to write a tic80 command/tool conversor
and editing a sound file by command line
IIRC the original ask was importing / conversion, not editing.
It makes no sense
Only that I'm unfamiliar with audacity and was able to get sox
to do the job in just a few min. I'm sure there are others who'd rather install a simple CLI than a bloated GUI. It's great for people to have choices.
What else could I add?
I dunno. I'm just waiting to see a "woof" cartridge now. :-)
I dunno. I'm just waiting to see a "woof" cartridge now. :-)
WooF = https://www.youtube.com/watch?v=kNEfRhmhP80
if this cmd/tool would exists, the woof sound could be replaced/improved in this nice game = https://tic80.com/play?cart=1483
i agree with you in the sense different users feel different comfortable with a cli or gui external conversion utility (but i still dream tic80 will have builtin conversor+importer in the future :) )
... but in my case, tic80 wav conversion is not the only thing i will use audacity
, i also use it to clean old recordings from cassette (my mother has boxes full of them), or to process myself speaking/singing (for dubbing for example), or to get samples to make remixes in fruitloops/lmms... but for who only need to preprocess tic80 wavs or feel more comfortable with it, sox
would be also perfect....
IIRC the original ask was importing / conversion, not editing.
i agree with that either
if this cmd/tool would exists
have you seen https://github.com/nesbox/TIC-80/issues/2162#issuecomment-1500893407 ?
Cheers, bzt
It supports mono and stereo .wav files, with unsinged 8-bit, signed 8-bit, 16-bit, 24-bit and 32-bit floating point samples.
Is this code on github? If so I'd be curious for a link to the downsampling code.
Is this code on github? If so I'd be curious for a link to the downsampling code.
Yes, obviously...
It is right here, in this topic, as an attachment to https://github.com/nesbox/TIC-80/issues/2162#issuecomment-1500893407 and as I've said, CC-0 licensed, source included in the zip (just ca. 50 SLoC, as simple as it gets).
I've also said that it does not do Hz conversion or anything fancy stuff, it just takes 32 samples from the .wav and saves those samples in .tic format. That's all it does.
Cheers, bzt
It is right here, in this topic, as an attachment
No I meant a repository here on Github so I can read and see the code here on the net (and perhaps watch it change over time, or even contribute, I'm not interested in a unchanging zip file...
i have another idea ...... i think would be super easy to developers, to add a command to import (copy) waveforms from one cartridge to another, from one slot to another :) .. something like:
> import sfx id=3 soundlib.cart id=7
do you get the idea? ... this would be a excelent combination with the importer tool.... with this function we could add sounds to our catridge on the progess, without the need to start a project from scratch from a blank cartridge with sounds generated by the tool, and will gives us the possibility to organize and manage our sounds and create library cartridges, and re-use our sound banks for other projects :)
No I meant a repository here on Github so I can read and see the code here on the net
We are bit lazy and demanding, aren't we? Nope, I've created the solution and uploaded it here, and I'm not planning to create a repo for it. I already have way too many repos to maintain, plus I got much bigger fish to fry.
I was mentioning the CC-0 license to tell you, you can do whatever you want with it, including creating a repo for it if that's what you want.
I'm not interested in a unchanging zip file...
That's all you got. Don't be lazy, just click on it and open main.c in Notepad. You can take a look at the source if you really want to. (But as I've said, nothing special, it just copies 32 samples from .wav to .tic format, that's all, nothing extraordinary or interesting).
i think would be super easy to developers, to add a command to import (copy) waveforms
I agree the perfect solution would be not this tool but to have an integrated command in TIC-80 to import .wav files. Open call to anyone: feel free to use the C code in my tool to implement this.
Cheers, bzt
We are bit lazy and demanding,
It was clearly a question, not a demand.. π€ͺ Perhaps a little lazy - but bigger picture it's more about long-term thinking, can I contribute, report bugs, etc... it sounds like you have too many other things on your plate, which makes me less interested. I don't really want to "own" the code (and its' bugs) either, but perhaps could have wanted to contribute.
I already have way too many repos to maintain, plus I got much bigger fish to fry.
Fair. I hear you on that.
i think would be super easy to developers, to add a command to import (copy) waveforms
I agree the perfect solution would be not this tool but to have an integrated command in TIC-80 to import .wav files. Open call to anyone: feel free to use the C code in my tool to implement this.
yes, but this is a little different than the solution we are discussing here (an internal/external command to import a .wav into cart)
... with this new idea i mean.. an internal command (ideally) that just open a .cart file and READ bytes in CHUNK_WAVEFORM area ... then COPY to ram WAVEFORMS area (0x0FFE4) .... copy waveforms from some other catridge, one-to-one, to the cart loaded in ram (assuming no conversion needed).... from one slot to another
just copy data as is, from there to here... or if loading data into ram is hard, at least from one .cart file to another .cart file
@bztsrc : could you please include some readme/man file or something, with more detailed information on how to use wav2tic
?? ... because the help page is also very swallow xD .... you know how this tool work, you wrote it.. but we dont and you should teach us how to use it, like a kid
requirements, arguments, etc .. what means -u
? ... will work with any .wav file? ... how to make if i want to place lats say in slot 5 ??, will it work with existing .cart files??, without messing the rest of cartridge?? ... etc etc
can it take soudforms from clipboard?? (supposing we have open audacity or similar, and we just select an audio slice an copy to clipboard)
can waw2tic
read a .wav and load into currently loaded cart? (ram)
could wav2tic
copy soundforms from one cartridge file to another catridge file? .. from/to arbitrary slots?? ... etc etc
thanks
hey... i discovered you can copy an instrument from one open cartridge to another...
now i have 2 tic80 running instances, so i can copy one sfx from an old project to my new project .... they copy envelopes from one of 64 instrument slot to another, and waveforms from one 16 slots to another, using the clipboard buttons ^^D
... so half or my questions above are answered... maybe tic80 clipboard format could be exploited in some other tool
Fair. I hear you on that.
Sorry that I can't help more. But I believe I have provided everything needed to implement this.
could you please include some readme/man file or something, with more detailed information on how to use wav2tic ??
No need, it is really this simple.
wav2tic [-u] <wav> [wav [wav ...]]
-u: .wav has unsinged 8-bit samples
what means -u?
As the usage says (for some reason beyond my comprehension Audacity can only save unsigned values for 8-bit... Not with the other variants (16-bit, 24-bit, 32-bit, float), those are all signed as should be...
Sadly this information isn't stored in the header and other tools like FT2, MilkyTracker, OpenMPT, etc. can work with both signed and unsigned samples,
so these other than Audacity tools tend to export signed 8-bit samples as expected, hence the
-u
option. Would be better if all tools would save signed 8-bit, or if there were a flag in the .wav header to tell if the samples are unsigned, but there isn't.)
will work with any .wav file?
Yes, mono/stereo, 8-bit, 16-bit, 24-bit, 32-bit and float samples too (everything except the proprietary PCM encodings). For best results, use only mono .wav files which have exactly 32 samples.
how to make if i want to place lats say in slot 5 ??
As I wrote here, each .wav file will be loaded at the next free slot. I you want a specific .wav to appear at slot 5, you'll have to add 4 (possibly silence) .wav files before.
can it take soudforms from clipboard??
Nope. This is as simple as it gets, it just reads files, and saves output.tic
.
can waw2tic read a .wav and load into currently loaded cart?
Nope, this is a command line tool. To read samples into the currently loaded cart, you'll need TIC-80 and a currently loaded cart in the first place... You'll have to implement the import sfx
command in TIC-80 using this code for that.
Cheers, bzt
hi... the documentation is very swallow... but i was reading the "import" console command, not too much explanatory
as far as i understood, we can open tic-80 folder ("folder" command) and once opened we can place any file we want, for each tic80 "editor":
but what about SOUND? ... is very tedious having to plot waves dot by dot, moreover i cant imagine how it will end sounding, is more like a trial-error process... it is also very hard to try to match some sound with other "real" one, would be great if we could just sample, lower the quality and just import
would be great if import could also work with sound files (wav?), and the documentation specifies the process and wave format (frequency, bit resolution, which voice/channel, etc)
.... in case it doesnt support.. if does could you please update documentation in details?... thanks