Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / recordsound() is this a function thats being dropped or worked on?

Author
Message
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 22nd Oct 2016 18:39
Quote: "recordsound() is this a function thats being dropped or worked on?"

if it is still being developed would you also be able to add commands to save it out as oggvorbis? Id like to start work on a music editor but there is not much point yet without being able to record its playback as a wav and also ogg vorbis afterwards.

it needs to be able to capture sound that its playing. if its setup to capture just the mic this command will not work for me. Maybe have a set option of what its capturing sound from would be great. for my windows pc i have it set to stereo mix.... would want something simular.
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 27th Oct 2016 21:52 Edited at: 27th Oct 2016 22:00
Quote: "
but there is not much point yet without being able to record its playback as a wav
"


Yes, there is!

I am currently building a synthesizer in AppGameKit T1, it can even save .wav files correctly by using CreateSoundFromMemblock().
Right now I work on waveform generators.
I only miss a correct triangle wave function right now, and I also have to verify the maths behind.
So the idea is, each sound that will be played at a certain time has a custom waveform, that will be added to the total waveform of the song at the
same time the sound is placed in the timeline editor. Then you have to "render" a .wav waveform and save it by the memblock to sound command.
This will be also much faster than the playback capture.

My current Synth WIP code, maybe you find a good use for it! :
maybe you can get stereo, 16bit sound going, the current code does not support anything else than 8bit mono.





You should be ready to go

[/url]
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Oct 2016 15:06 Edited at: 28th Oct 2016 15:22
interesting...

what i do is play back recorded wav sound notes. while these notes are playing i have a recording function recording the stereo mix on my windows pc. this is how my qmidi studio works.
currently i can make the editor with agk and even produce midi files but i would be unable to produce a wav file since i have no knowledge of the wav file format.

I do however have the knowledge to write a midi file.... so in this case i could probably just make the editor but you would need another editor just to record the midi to a wav/ogg format.
I was hoping to have that option before starting.


here are some examples. all 3 files are the same but one is midi playback, second is ogg playback, 3rd is seamless ogg playback using agkv2. The recorded samples sound much better then the midi sound instruments!

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Oct 2016 15:25
fyi.... windows media player does not play seamless.... at least not on my pc
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 28th Oct 2016 18:44 Edited at: 28th Oct 2016 18:52
Quote: "
currently i can make the editor with agk and even produce midi files but i would be unable to produce a wav file since i have no knowledge of the wav file format."


You managed the OBJ format, so you will get .wav aswell

The .wav is the .bmp of sound

Just a header, explaining the format (channels,bitrate,length)
and a wave data like this one:
[href]null[/href]
Each sound has such a wave that can be extracted to an array and visualized like that one above.
What you want is to create an array that represent your whole music file (array length = total samples-1)
And then you will have to add the wave at the time it was played into the array like that: http://clas.mq.edu.au/speech/acoustics/waveforms/adding_waveforms.html
In 8bit sound you save the waveform as byte (0-255) in a 16 Bit sound, you save the waveform as Short into the memblock

Create a Memblock, wite .wav header in it (explained in the AppGameKit memblock2sound commands how to manage it)
add the array of your whole song at the end of the memblock. Memblock2Sound, Save Sound and you have a .wav file of your whole song!
I will try to create some sort of waveform editor, but I struggle with a lot of work right now, so I can only help you in theory. :-(




[/url]
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 2nd Nov 2016 20:52
Thanks for the info... I should learn this format next i guess. I'm currently playing around with c finally but a much older version running on win 3.x lol. I figured id have a good chance learning c if i start off in 16 bit and work my way up.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 3rd Nov 2016 09:23
Borland Turbo C was my fave! A little in-line assembly for all the VGA control stuff. Awesome
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 3rd Nov 2016 10:26
Can I direct you to this thread
https://forum.thegamecreators.com/thread/217958

It plays sound from memory and generates a waveform before.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 3rd Nov 2016 10:39 Edited at: 3rd Nov 2016 10:51
@SoftMotion3D,

you could use VLC with SoundFont

There is no Need for Recording MIDI the way you described it. Because other sources could make noise and lower the quality of your recording.
https://wiki.videolan.org/Midi/

You can use your WAVE-samples and do math in memory to generate the complete song without hearing it in the soundcard.

Do you know: http://www.bluemoon.ee/history/scwin/



If anybody works on a synthesizer I can recommend:

Hively Tracker
http://www.hivelytracker.co.uk/downl.php

Bsfxr
http://www.bfxr.net/

AudioPlayground written in PureBasic with SourceCode
http://www.purebasic.fr/english/viewtopic.php?f=27&t=50160



They also provide source code. Would be nice, to see some code ports to AGK2 Basic.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 3rd Nov 2016 15:42
Ok thanks guys. Ill do some reading and try to learn something new with sound

For the c++ /c thing... I downloaded visual basic 1.0 ... The forms thing seams like too much to comprehend so i ordered a book to explain it better. Is borland turbo c msdos based or windows? Maybe i should look at that one first.
damothegreat
User Banned
Posted: 3rd Nov 2016 15:51
Hello

I think Borland C++ is the good ole days - its MSDOS based IDE which can create (up to 32 bit apps only from v4.52) - doesn't support 64 bit .

More info here if it helps
[link]https://en.wikipedia.org/wiki/Borland_C%2B%2B[/link]

Damo
Using Tier 1 AppGameKit V2
Started coding with AMOS
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 4th Nov 2016 02:28 Edited at: 4th Nov 2016 02:38
Hello SoftMotion,

Today I found some time to create a simple set of functions to load .wav files to an array.
It just misses a function to merge sounds.
You can even apply a lowpass or highpass filter to the sound array data. The visualisation of the sound data
can help you to understand whats going on. Do some functions with modfications - its nearly a full .wav editor

I've attached you the whole project with media.



View from AGK:


View from Audio Editor:


seems legit

[/url]

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 13:55
oh wow...thanks.

i have today off from work so i will play around with this.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 14:08
after looking at your code....

how would you go about mixing sounds together?

is it a matter of staggering the data only writing segments of it?

eg: channel 1 xxxxxxxxxxxx
eg: channel 2 ooooooooooo

is it as simple as: xoxoxoxoxo staggering it but loosing some of the data? or can it all be stored somehow together without losing data?

that example you gave me.... how would you go about mixing the 2 channels left and right together to produce mono?
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Nov 2016 14:13 Edited at: 4th Nov 2016 14:15
Id'd probably take the sound data from sample 1, and average it with the sound data from sample 2.

So if the value of sample 1 is 128, and the value of sample 2 is 192, the final mixed value would be 160. (Add both values together, then divide by 2 because you're mixing two samples..)


I've never tried it so don't know if this is right, but sounds reasonable to me,
damothegreat
User Banned
Posted: 4th Nov 2016 14:31
If anyone knew AMOS, a nice commandset what VuMeters. Giving a nice representation of music channels and levels.

Could do some funky bars on sound channels.

I.E Attached images

Would be nice if could develop something along these lines.

But if music only got 2 possible channels and graphing the sound level of each level then wouldn't be as funky as 4/5 or 6 level channels

Damo
Using Tier 1 AppGameKit V2
Started coding with AMOS

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 14:46 Edited at: 4th Nov 2016 16:23
i tried the staggering data and it does sound like it got mixed.

i will try the average out and see if it sounds better and report my results


result#1:
the only problem is when you grab an average and there is nothing on the second channel and data on the first ....it ends up cutting the volume of the sound in half averaging it.
maybe not in half but something to that effect.
ill do more testing and see what else i can do to mix

result#2:
taking the greatest value of the 2 sounds gets heavily distorted but sounds mixed

result#3:
staggering data taking one channels data then the other seams to work.... but doesnt sound as smooth as average data


result#4:
i think this is the answer but not sure yet.... normally taking average would be (sounda+soundb)/2.0
but change that...
(sounda+soundb)/1.9 seams to fix loudness issues but will need to do more testing. A smaller number then 2 from averaging it does infact increase volume for sure!
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 18:22 Edited at: 4th Nov 2016 18:30
further looking into it i have come up with a sound table and am starting to learn the memblock sound manipulation.

i was alternating data to see if i could manipulate sound tones.... i think i have come up with a sound simular to the old basic languages that could generate a tone like a trs-80 for example.




i think averaging the data is the correct way to go for mixing to keep it smooth.... i think i can make an editor from what i have learned already.
let me sync up the tones with actual notes and see if i can play back a tune with code.... say twinkle twinkle little star or something.

ill post when i got that working.


edit:
this could be a possible sfx maker too i think.
change this line

if pop=>len1

to this:

if pop=>len1-(loopcr/(len1+1.0))

and you have a sound effect...lol
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 4th Nov 2016 19:09
I think there is a "loudness" problem in (a+b)/2.0.
If I tried to merge a stack of sounds and checked the results between, the first ones got quiet after some time.
This was also my bottleneck at dbp times, but I think now I am able to solve the problem. A signal frequency can have
diffrent loudness levels. For example, the 500 Hz tone has half the sound pressure level of the 100 Hz tone so you acutally
have to set the amplitude in relation to the frequency.

[/url]
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 20:51
ok here is a simple tone generator.... i can see i will need to do major editing to get real cdefgab noises coded as the tones this currently produces will need to be mixed together to form proper notes.

try it out
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2016 23:14 Edited at: 5th Nov 2016 16:32
well i gave it a good go but didnt manage to link every sound tone properly.

this will take allot longer to figure out!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 5th Nov 2016 21:32
Add the samples together to mix.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 5th Nov 2016 22:04
Quote: "Add the samples together to mix."

ya thats probably the way to go. creating tones from scratch though was very interesting
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 6th Nov 2016 19:35
@SoftMotion3D, did you looked up the link I posted?

https://forum.thegamecreators.com/thread/217958

You have to know, which kind of tone you want. Triangle, Saw, Sinus, etc.

So if you mean Sinewaves you have to rotate your circle. Easiest is Squarewave like in the example (please see the link)

You see the waveform in the pictures, imagine, that you only put the hight (Y) of the Pixel in the MemBlock, and X is your time. And the Frequenzy is how often your values are alternating from zero.
at 8 bit with signed 0 is 0. With 16 Bit unsigned, you have to add or substracted something, it depense on your wavefileformat.

This video explains it in a great way
https://www.youtube.com/watch?v=YsZKvLnf7wU

Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 6th Nov 2016 23:29
Messy code. Was late. A port from CreateSound function from

AudioPlayground written in PureBasic with SourceCode
http://www.purebasic.fr/english/viewtopic.php?f=27&t=50160



Does still not sound like a Sinewave in comparison. Don't know, what I done wrong. Maybe AGK2 Basic does thinks in another way. Or I overlooked something.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 7th Nov 2016 03:49
Ok... Well i havent givin up yet. Ill see if i can mix what i have learned with your code.

Havent checked that link yet... Ill try to find time this week to.

Overall it would be very cool to have the ability to create all media from code including music.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 7th Nov 2016 13:20
SoftMotion3D wrote: "Overall it would be very cool to have the ability to create all media from code including music."


That would be nice for prototyping and smaller file size. For Music and Sound-Effects it would be the best, to be able to play AHX / HVL music files, the could fit in some bytes.
For textures ... puh, maybe something like kkrieger in 96kByte But generating textures and sounds in the program could also cost time. Hope you do not give up and share your results with us.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 8th Nov 2016 03:50 Edited at: 8th Nov 2016 05:24
some good news

these now work:
square
triangle
saw tooth
buzzsaw

what do these have in common? none of them use the sin() command to produce the sound wave

im looking into it further cause id really like to get the rest working!

edit: i am currently mapping 6 octaves together... i should be able to play some actual midi (mml code) possibly tomorrow. I will try to use random noise for the percussion...hehe
im using the app cleartune to calibrate it... so it should be good to go.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 10th Nov 2016 01:58
ok i got music playing back!

i will share the code soon but i want to ask.... would anyone be interested in music macro language?
well.... its coded in already now but i would like to make some enhancements to mml anyways such as pitch bend and balance change


what code would you be after?

what do i want to do? i want to advance the mml language and also build a wav exporter to convert mml to a song wav file. Id also be interested in making a little music tracker app.

what does mml look like?

this:


this is an example exported from my music app qmidi studio and im looking at adding to it so it converts midi files even better.

anyways... let me know what your after. i can post an example if you want showing it in action playing music back without any media.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 10th Nov 2016 03:36 Edited at: 10th Nov 2016 03:48
its too neat not to share.....

so here is a very early showcase of it making the tones and playing it with 0 media

This example has 3 songs.... song 2 is the biggest load on the processor (need a faster pc for it) and i need to optimize it allot!

this uses pcm_noise and triangle only.... i am working on setting instruments with mml export on qmidi studio and will update with more progress..

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 11th Nov 2016 00:05
lol.... i got wav channels mixing now

it takes a while to compile a song but once its done it sounds very smooth.
download this mp3 sound created from pure code. It took all day but it creates plenty of memblock sounds reusing up to 20 of them at once with code then mixes them on a master memblock and outputs a wav file
im going to see about creating better percussion and then wav balance ...then multiple instruments.

again... this is code that can generate a song with 0 media and thats what this example mp3 was made from. (triangle and pcm noise)

Attachments

Login to view attachments
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 12th Nov 2016 14:36
Sounds great. How long would your code need, to create this file into memory? Or would it be better, to player it on the fly like tracker do it?
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 12th Nov 2016 14:52 Edited at: 12th Nov 2016 15:22
@SoftMotion3D, you called your last upload mml1.zip, is it real Music Makro Language like the one SiON can play?

http://woolyss.com/chipmusic-mml.php


Maybe you also know the Mabinogi MML Editor 2
http://3ml.jp/download.html



SiON
https://sites.google.com/site/sioncenter/example

Or is it more like MXDRV?
http://gorry.haun.org/mx/

Screenshots from MXV and SchismTracker

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Nov 2016 04:30
Depending on note lengths... As long as your songs not busy you could play it on the fly. Infact would be the best way to go for a tracker so you can follow along with it.

Music macro language yes but it needs more work. I made some changes to it to get longer note lengths also.

Problem i have right now is mixing sounds...
Its painfull and is allot more then just taking the average.

If you have a sound fading and another going strong it ends up jerking back to full attack on the strong sound making it sound like a note was re triggered to on from off.

I need to average it in a way that it favors the strongest note so it doesnt jerk the sound badly



SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Nov 2016 13:50
interesting enough... the answer was adding them together and adjusting the gain if necessary for the whole song. Allot of information on the web points this to being wrong but it couldnt be more right if you take this test for example...

what happens to agk when you get multiple instances of the same sound playing at the same time? it gets louder! So after discovering this it was easy to get the fade in and fade out that i was after to sound smooth.

so if you build a tracker you should have an adjustable gain for each track..... allow the composer to edit this per track so when its added in it will sound as desired.
i have a bit more tweeking to do and ill clean up the code and post it.

@ f4ktor... the only problem you had in your original code for the square,triangle, buzzsaw,sawtooth was the sign function you had was not passing a float value threw.
I noticed in agk allot of math gets buggered up when you cast a float to integer also if you dont add a 0.0 to it ...it just assumes you put all integers into the math if any.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 21st Nov 2016 17:11 Edited at: 21st Nov 2016 17:12
Progress update...

I cant get the triangle noise to stop poping the speaker when it starts and stops...

Got more mml code to process...

This does not seam practical to use for anything... it would be better to use recorded tones for better sound quality.

Last thing i will do is code in mml to midi.

At least with that you can compose music and save it as midi at the least for playback.

So there will be code to show adding sounds together and save as wav and also a command to dump music to midi file which will sound better without using recorded tones
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 22nd Nov 2016 10:31
Popping could came from Waves, which are not beginning and ending at the Zero-Line.

For Loading instruments I can direct you to SingleCycleWaves.
http://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/

Or first trying playing S3M or MOD. This would be much easier I think.
[video=youtube]https://www.youtube.com/watch?v=Qvy_qXBHVYY[/video]

looking forward for your progress.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Nov 2016 23:13
cool ill look at that when i get time.

for now i got the code to produce midi files (working) but not finished.

i have moved it over to its own post....

https://forum.thegamecreators.com/thread/218355

(this thread can be locked) since its off topic and doesnt look like getting the record sound function anytime soon will happen.

Login to post a reply

Server time is: 2024-04-25 12:35:02
Your offset time is: 2024-04-25 12:35:02