討論區: 幫助論壇 (Thread #18878)

Speaker Usage (2008-06-02 00:47 by 匿名 #36967)

Hi ClassicIll,

first of, thank you so much for the library!

But i have some Questions that are not answered by reading all the doku (i'm quite new to processing and programming, sry ^^).

How do i access the speaker, in the wiki it says
[quote]
<Speaker>
void bufferSound(AudioInputStream audioIn)
float getSpeakerVolume()
void setSpeakerVolume(float volume)
boolean isPlayingSound()
void playPrebufferedSound()
void playSound(AudioInputStream audioIn)
void stopSound()
[/quote]
but i cant get just one to work...
and what do i "give" the playSound() void anyway? a "playme.wav" ?
since there is no way to play a sound in p5, i usualy use the sonia Library for that.

everything else works quite fine (the detection of wiiMode and so on) so thank you again for doing this great work!

Im using winXP,processing 135, BlueCove version 2.0.2 on widcomm and Java Build 1.6.0_06-b02


Troop

回覆 #36967×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: Speaker Usage (2008-06-03 01:26 by classiclll #36974)

hi Troop
sound functionalites are not implimented till now.
i have little skill arround sound format.
sorry
for more info, see middle of the following thread
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1186928645;start=75
回覆: #36967

回覆 #36974×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: Speaker Usage (2008-06-04 21:07 by 匿名 #36994)

Hi Classiclll,

thx for reply, ill try with the WiiremoteJ!
Ill let u know if i make any progress.

Thank you.

cheers,

Troop
回覆: #36967

回覆 #36994×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

hi troop (2008-06-05 18:49 by classiclll #37011)

waiting for your progress
good luck!
回覆: #36967

回覆 #37011×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: Speaker Usage... progress? (2008-08-06 23:19 by 匿名 #38123)

it works in wrj4p5 as well.. difficult- but works:

import these two here:
--code-----------------------
import javax.sound.sampled.*;
import wiiremotej.*;
-----------------------------

and this void:
--code-----------------------

void loadSound()
{
try
{
//Prebuffer a preformatted audio file
System.out.println("Buffering audio file...");
AudioInputStream audio = AudioSystem.getAudioInputStream(new java.io.File("/Users/matthiaslowe/Documents/Processing/tlabs/wiitest_all/data/Audio.au"));
// AudioInputStream audio = AudioSystem.getAudioInputStream(new java.io.File("C:/litesab3.au"));

wii.rimokon.bufferSound( audio );

//prebuf = WiiRemote.bufferSound(audio);
System.out.println("Prebuf done: ");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
-----------------------------

now you can load a sound with loadSound(); and play it with wii.rimokon.playBuffer();

the Audio.au file is my problem...
i used a Sun/NeXt audio format, mono, 1794Hz, 8-bit PCM sound. but the wiimote-techheads at some internetsites guess its a 4-bit adpcm sound (which is possible with wav- but wav is not accepted by the library). so.. if your soundfile is not simple enough you'll get a lot of distortion. square-wave sounds are working fine, but we want music and voice,no? ;)

cya, ma_d
回覆: #36967

回覆 #38123×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: Speaker Usage... progress? (2008-08-07 18:36 by classiclll #38158)

hi ma_d
thank you for your feedback.
i think, "audio" can be converted by
- audiox = AudioSystem.getAudioInputStream( targetFormat, audio)
where targetformat(instance of AudioFormat) is set to be 4-bit at it's constuction(sampleSizeInBits).
回覆: #38123

回覆 #38158×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: Speaker Usage... progress? (2008-08-11 22:52 by 匿名 #38215)

hi!

thank you for the quick response. still, it does not seem to work. i get this error:
----------------------------------
java.lang.IllegalArgumentException: Unsupported conversion: PCM_SIGNED 1794.0 Hz, 4 bit, mono, 1 bytes/frame, from PCM_SIGNED 1794.0 Hz, 8 bit, mono, 1 bytes/frame,
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:955)
----------------------------------

did i something wrong or is it just impossible for now? i changed my code to this:
----------------------------------
AudioInputStream audio = AudioSystem.getAudioInputStream(new java.io.File("/Users/mad/supersimple.au"));

AudioFormat targetFormat= new AudioFormat(1794, 4, 1, true, true);
//Audioformat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian);

AudioInputStream audiox = AudioSystem.getAudioInputStream(targetFormat, audio);
wii.rimokon.bufferSound( audiox );
----------------------------------

thank you in advance! ma_d

回覆: #38158

回覆 #38215×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

My compliments (2008-09-26 09:13 by 匿名 #39024)

very nice site :)
回覆: #36967

回覆 #39024×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

RE: My compliments (2008-09-26 16:20 by classiclll #39032)

thnx!
回覆: #39024

回覆 #39032×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入

Hello nice site (2008-10-14 18:07 by 匿名 #39278)

very nice site :)
回覆: #36967

回覆 #39278×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) 登入