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 / V2 7.1+ New sound features

Author
Message
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Oct 2014 20:08 Edited at: 3rd Nov 2014 10:24
Some of the new sound features are quite powerful. I'll make a series of tiny demos to illustrate this.

Here is the first one. Playingsound2. The zip contains an EXE as well as the project. I'll leave you to make APKs and Mac stuff.

Many of the AppGameKit examples contain hardly any comments. This contains the minimum of code and a lot of comment.

1st November

Added Playsound3

3rd November

Updated this file to use a 16-bit PCM sample

-- Jim - When is there going to be a release?

Attachments

Login to view attachments
Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 21st Oct 2014 21:01
awesome! cheers Jim

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 21st Oct 2014 21:39
Cheers! That's a neat little program!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 21st Oct 2014 21:41
That's pretty cool! I was doing a Pink Floyd jam for a minute. Just need to accompany this with visuals and you've got a trippy app.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Oct 2014 22:55
Thanks, guys. I don't want to do apps here - just the smallest fragments reasonably possible - hence the lack of graphics.

Naphier - I'll give you some music examples later this week!

-- Jim - When is there going to be a release?
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 21st Oct 2014 23:08
Hi Jim,
I am not a music guy and I cannot assess.
But I managed to make some interesting sound effects while I was playing.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 21st Oct 2014 23:29
Giorgo - yassou!

This isn't music - it's just sound position and pitch.

Bouzoukis come later!!!! Yammas.

-- Jim - When is there going to be a release?
IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 22nd Oct 2014 01:50
Way to go James T !. Pretty damn cool. had fun just a clickin around, Keep up the great work.

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 22nd Oct 2014 13:04 Edited at: 22nd Oct 2014 13:05
I'm looking at two little development steps which might be good until we have full support for OpenAL:

Area sound

It's all very well sticking a bit of music on and making zap noises, but ambient atmosphere can help a lot. As your avatar moves from place to place, how nice it is to vary the sound context, but not in a sudden way unless she goes into building and the outside world noise suddenly diminishes. To do this requires multiple looping ambient sounds and a roll-off that can be set. In 3D games this is usually a virtual distance - say it attenuates down to and ceases at 100 metres. This is perfectly doable with the new sound system.

MOD player

Those of above a certain age will remember music mod files. There are thousands of these out there. Their advantage is that they are very small. The attached mod file is 83K in size. It should play in Media Player, WinAmp or VLC.

I will try to pull this off - but I'm not sure if the bytecode interpreter will be fast enough for T1. I may have to convert to a special format, in which case I'll make the tool available. What do you think?

-- Jim - When is there going to be a release?

Attachments

Login to view attachments
Alex_Peres
AGK Master
14
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 22nd Oct 2014 13:45
Cool!
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 24th Oct 2014 01:16
I've spent a couple of days on and off away from the day job (because I'm not well) messing about with MOD files and formats.

Originally created for the Amiga - particularly for flashy demos - the MOD format is highly memory efficient, using 8-bit samples and a pattern system that could make excellent use of the Amiga's very good 4 8-bit DACs.

Music sequencing requires 1-2 millisecond timing interrupts, which was easy on the Amiga. Unfortunately, AGK's frame-based system makes this very difficult to do. Using the frame-rate is totally inadequate for serious music synchronisation.

Playing "block samples" is mostly okay, unless your graphics etc is driving the frame-rate seriously down.

This is a rather sad reflection on the fact that modern devices are in many ways less capable than the hardware we were using in the 1980s.

-- Jim - When is there going to be a release?
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Oct 2014 09:50
Just tried your demo, and looked at your code. So simple, yet so awesome

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Oct 2014 11:48
I'm some way into converting mod files so that they'll play, or at least provide a mechanism to extract the samples for use in an AppGameKit tracker that'll program.

-- Jim - When is there going to be a release?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 26th Oct 2014 14:26 Edited at: 26th Oct 2014 14:29
Where you see the new sound features??? (i use tier 2)

I developed a mod player some months ago for AppGameKit + iOS.
And it work very nice.
This was the video of the first test...



JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Oct 2014 14:42
Try looking at the V2 sound commands!

Why just iOS? The whole point of AppGameKit is to be cross-platform. So convert your iOS-specific code to standard AppGameKit and save us all some effort.

Looking forward to it!

-- Jim - When is there going to be a release?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 30th Oct 2014 14:00
GEKKO - Are you going to answer this? I don't want to waste time re-inventing things which you have covered!

-- Jim - When is there going to be a release?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Oct 2014 17:08
Quote: "I was doing a Pink Floyd jam for a minute"


First thing that came to mind when I clicked.

RickV
TGC Development Director
23
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 31st Oct 2014 16:00
Hi,

This would make a good entry in to the competition!

Last day for submission BTW!

Rick

Development Director
TGC Team
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 1st Nov 2014 11:41 Edited at: 2nd Nov 2014 10:16
I've added a more complex demo - Playsound3

This demonstrates ring-buffers and applying simple volume changes.

The file is now in the next message.

-- Jim - When is there going to be a release?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 10:27 Edited at: 2nd Nov 2014 10:33
I think there may be a problem on Android. Like - it doesn't work.

Here is the updated source:

-- Jim - When is there going to be a release?

Attachments

Login to view attachments
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 10:42 Edited at: 2nd Nov 2014 13:49
Here is the APK. Install and run but DON'T click yet. What are the Min and Max numbers.

On two PCs here the Min is 0.000977 and the Max is 1024.0

On two Android devices the Min is 0.5 and the Max is 0.5, and the sound does not change pitch.

This is what the device call GetSoundMinRate() says in the help file:

Gets the minimum rate and which sound files can be played on this device. A rate of 1.0 is normal speed, a rate of 2.0 would be double speed, 0.5 would be half speed, and so on. If you attempt to change a sound playback rate outside of these values it will be clamped to these values. If both min and max return 1.0 then changing the speed of sound playback is not supported on this device.

Both calls returning 0.5 is odd. I'd be grateful if you would give it a test and report back.

Of course, it's possible that I've screwed up - if so, please let me know.

-- Jim - When is there going to be a release?

Attachments

Login to view attachments
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 2nd Nov 2014 11:40 Edited at: 2nd Nov 2014 11:47
JimHawkins:
Tried it twice on my phone now, the apk doesn't want to install. I only get an error message that the app hasn't been installed.

BTW, the attached zip file in the first post is still version 2.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 11:53
Don't know why - it installed on two different tablets here. Maybe the default window size is too big?

Try compiling it yourself...

-- Jim - When is there going to be a release?
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 2nd Nov 2014 13:30
Is there documentation on the new V2 commands yet? I've had a look around but can only find the original V1 commands. I'd like to read up on the new sound commands (in particular the sound instances Jim shows in the demo).
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 13:47
Try running the latest versions of AppGameKit 2, select Help, and look at Sound.

-- Jim - When is there going to be a release?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 13:51
Quote: "BTW, the attached zip file in the first post is still version 2."


Different program!

-- Jim - When is there going to be a release?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Nov 2014 15:53 Edited at: 2nd Nov 2014 15:54
Google Nexus 4 phone - min and max = 0.5, pitch isn't working.
On Windows - works fine

[Edit] I built for 2.3.1 and 3.2, both have same problem

Quidquid latine dictum sit, altum sonatur
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2014 19:52
I've fixed GetSoundMaxRate on Android for the next version, it was incorrectly returning the minimum value. However the sound file still doesn't play on Android because it looks like Android doesn't support 32bit float WAV files.
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 2nd Nov 2014 20:00
Quote: "Try running the latest versions of AppGameKit 2, select Help, and look at Sound.
"

At least I didn't embarrass myself with a dumbo question....oh wait...

Cheers Jim.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 21:27
Paul - sonarping2.wav does play on Android - I changed the sample for that reason. Can you get any sounds to modify?

-- Jim - When is there going to be a release?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2014 22:34
Quote: "Can you get any sounds to modify?"


After fixing the GetSoundMaxRate command and using the 16bit WAV file the sounds are modified on Android.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Nov 2014 22:46
Great, Paul. Bung us an update as soon as possible

-- Jim - When is there going to be a release?
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 3rd Nov 2014 03:56
hey those new commands are deffinetly usefull.

i tried out your app and its neat. From experience creating music editors using sound files i have learned that you can get away with using 1 sound file for ~3 notes providing you have the ability to change the wavs pitch which you now can. Every other note starts to become detuned and starts to sound flat.

Have you found this to be the same jim?

agk has the potential to make a good music editor... i know because i have already done one using agk v1 for blackberry playbook. Its now just gotten more powerfull!

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 3rd Nov 2014 06:33
I found similar oddities with sound on Android, both setting the sound rate (which Paul says has been fixed for next update) and it seems playing more than a few sounds would end up silencing them all but I haven't tested much.

I think that if we could set the FREQUENCY/PITCH of a sound we would be able to do a lot more than what we can with only RATE. This would allow very nice distortion effects and generation of musical notes that are all the same length but different octave. By changing the RATE as Jim's cool demo shows, we can get different pitches at the expense of speeding up or slowing down the entire audio sample. Clicking the top of Jim's demo will last about 1 second versus 10 seconds or so at bottom. I'm thinking of stuff like http://tonematrix.audiotool.com/ that'd be more achievable with limited media if AppGameKit supported core pitch or frequency alteration.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Nov 2014 09:07
@SoftMotion3d - a lot depends on the sample, really. But I've always worked on +- 3 semitones as a reasonable way to do it. Ideally you want a sample per note: that's 88 samples for a grand piano, but using +- 3 you can do it with 13 samples. Very few instruments have that range, anyway. For example the range of a flute is about 46 semitones, so 7 samples will cover it.

Another key factor is that really for non-percussive instruments you need three segments for a note: attack - sustain (loop) - and decay. I'll do some experiments.

@xCept - I doubt if most phones or tablets have adequate processing power to do this kind of signal processing. Some things could be done in memblocks, but I doubt if a byte-code interpreter will be up to it!

-- Jim - When is there going to be a release?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Nov 2014 10:25
I've update Playingsound2 (in first post) to use a correct sample.

-- Jim - When is there going to be a release?
3d point in space
14
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 3rd Nov 2014 11:26
One thing I am not good at yet is sound I have art skills and programming skills. I know beets but can't make my own music so good job.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Nov 2014 12:12
I'm crap at visual design, so I understand! I did Music to Scholarship Level and have done quite a few music and sound programs. (I programmed the original interactive sound system for the London Transport Museum when it opened, using a bank of modified Amiga CD32 motherboards!)

Many of us can produce sequencing software. The central issue is "Where do you get the samples from?"

The second issue is "Can I make this play on a crappy Android phone or an over-priced fashion-victim iOS device?" There are significant problems with this, and I like a challenge!

-- Jim - When is there going to be a release?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 3rd Nov 2014 13:32
I can't find the new sound commands... someone can link me the page?

@Jim
What you mean?

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 3rd Nov 2014 13:42
Try running AppGameKit and using Help.

What do I mean by what?

-- Jim - When is there going to be a release?
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 3rd Nov 2014 14:13 Edited at: 3rd Nov 2014 14:17
Quote: "The central issue is "Where do you get the samples from?""

what i did was used an external keyboard to sample instrument tones from.

i even wrote an app just for doing that. Its setup to sample every 3rd tone on an external keyboard. oh! it also has the option to do all the tones to sample the drum kits...etc

you can set how long you want to sample it as well.
i will dig it out after work today and upload it if anyone wants to use it. fyi it also works to sample from your midi sound card but some midi sound cards do not sound that good.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2014 01:40 Edited at: 4th Nov 2014 02:29
ok i could just save everyone a tun of work....
what instruments you want? i have about 135 of them and are the same ones used in my QmidiStudio for windows.
let me know and i could probably upload them onto my website.
and yes in the form of wav files.

i will post 2 instrumets, drumkit,piano

here is a complete midi drum kit-------------->

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Nov 2014 02:25
and here is a piano kit...skips by 3's

to hit the tones in between set your playback frequency to:

+1200 frequency for 1 tone up
regular frequency for main recorded tone which is 22000 and 16 bit
-1200 frequency for 1 tone lower

feel free to use....
here it is for anyone that wants to try it out.---------------->

Attachments

Login to view attachments
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 4th Nov 2014 09:07
That's very kind of you! Brilliant!

-- Jim - When is there going to be a release?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 5th Nov 2014 00:25
Maybe the MAC help doesn't have this inside.
In the new installation i can't found the new sound commands.

Login to post a reply

Server time is: 2024-04-24 05:00:16
Your offset time is: 2024-04-24 05:00:16