• 0

audio input and playback


Question

hi again all! i know i am posting alot lately but hopefully my topics are helping more then just me ... and i will say all the help i have gotten has helped me learn so much!

now I need to move on a bit with my project and start practising with hardware I am not going to ask you to do my work for me but I am asking for a kick start in the right direction ... can someone give me or link me to a bit of code which reads microphone input (I dont know a single thing about programming around hardware so i will just assume that a microphone jack and a built in mic have different bits of code so if you do help could you specify what hardware its accessing)

I then want to process that output and play it back PREFERABLY without out it being saved as a file on my machine as i am sure i could do that without help from you guys (google :D ) when i have a fair understanding on this I am going to try and build a voip ... so can anyone help me with a basic mic and play back program to get me started??

Link to comment
https://www.neowin.net/forum/topic/1127388-audio-input-and-playback/
Share on other sites

13 answers to this question

Recommended Posts

  • 0

The java media framework should do what you need:

http://www.cs.odu.ed...5Capturing.html

can i really call my self a programmer if i just use frameworks though ? :( I have always had a grudge against frameworks I am only going to get a A- max in my php assignment because one of the criteria was to use frameworks but i refused to and programmed it all from scratch, this java is not for an assignment but for personal learning .... do you think i am being silly and every programmer uses frame works or can you see my point?

although further inspection of this website you sent me has allowed me to see its just the basic kind of things rather then a whole program that you tweek xD standard java class sharing

brilliant link

  • 0

can i really call my self a programmer if i just use frameworks though ? :( I have always had a grudge against frameworks I am only going to get a A- max in my php assignment because one of the criteria was to use frameworks but i refused to and programmed it all from scratch, this java is not for an assignment but for personal learning .... do you think i am being silly and every programmer uses frame works or can you see my point?

although further inspection of this website you sent me has allowed me to see its just the basic kind of things rather then a whole program that you tweek xD standard java class sharing

There's no shame in using frameworks. Any way you do it you're already using code someone else wrote, whether it's in the JRE or not.

You can also use the internal javax.sound.sampled:

http://www.jsresources.org/examples/SimpleAudioRecorder.java.html

JMF might help later on though for video if you're interested in doing that.

  • 0

There's no shame in using frameworks. Any way you do it you're already using code someone else wrote, whether it's in the JRE or not.

You can also use the internal javax.sound.sampled:

http://www.jsresourc...order.java.html

JMF might help later on though for video if you're interested in doing that.

I have tried using the sound sampled thing before but I dunno getting the input is fine ... but setting the output as the input directly i am having trouble with i have only played saved files ... video will be a big yes ... I eventually want to make a 100% encrypted text, voice and video program ... stage 1 complete im now on to stage 2 voice :D I already have some methods planned for this should be about 3-5 months and the program should be 100% complete if I can get used to this JMF thing... already having problems with the first example (yes i have downloaded and put the JARS into my lib) its just saying its wrong lol I set di and got everything fine except the vector deviceList... its having a hissy ... if you have used this before could you tell me the issue? obviously im very new to this advanced (well i think its advanced) level of programming


// Get the CaptureDeviceInfo for the live audio capture device
Vector deviceList = CaptureDeviceManager.getDeviceList(new
AudioFormat("linear", 44100, 16, 2));
if (deviceList.size() > 0)
di = (CaptureDeviceInfo)deviceList.firstElement();
else
// Exit if we can't find a device that does linear, 44100Hz, 16 bit, stereo
System.exit(-1);
// Create a Player for the capture device:
try{
Player p = Manager.createPlayer(di.getLocator());
} catch (IOException e) {
} catch (NoPlayerException e) {}
[/CODE]

  • 0

Is it a compile error or a runtime error?

sorry went to bed xD was 5 am....

erm well it just said vector format not reconisged (or applicable) ... so i am trying to build up slowly using all the methods so at moment i am using this ...

and the error is a simple one but I dont understand this thing yet ...

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

The method getDeviceList(Format) in the type CaptureDeviceManager is not applicable for the arguments ()


public class AudioRecorder02 {
static CaptureDeviceInfo di = null;

public static void main(String args[]) {
CaptureDeviceManager.getDeviceList();
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("deviceName");
System.out.println(deviceInfo);
}
}
[/CODE]

  • 0

sorry went to bed xD was 5 am....

erm well it just said vector format not reconisged (or applicable) ... so i am trying to build up slowly using all the methods so at moment i am using this ...

and the error is a simple one but I dont understand this thing yet ...

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

The method getDeviceList(Format) in the type CaptureDeviceManager is not applicable for the arguments ()


public class AudioRecorder02 {
static CaptureDeviceInfo di = null;

public static void main(String args[]) {
CaptureDeviceManager.getDeviceList();
CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("deviceName");
System.out.println(deviceInfo);
}
}
[/CODE]

Make sure you're importing the right CaptureDeviceManager for the empty argument as there are two: [b]javax.media.cdm.CaptureDeviceManager [/b]and[b] javax.media.CaptureDeviceManager[/b]. The first one extends the second one to add a little more functionality to it. The second one doesn't accept an empty argument for getDeviceList though.

  • 0

Make sure you're importing the right CaptureDeviceManager for the empty argument as there are two: javax.media.cdm.CaptureDeviceManager and javax.media.CaptureDeviceManager. The first one extends the second one to add a little more functionality to it. The second one doesn't accept an empty argument for getDeviceList though.

Vector is a raw type. References to generic type Vector<E> should be parameterized

this is whatit says every time i try and use the vector "Vector deviceList = CaptureDeviceManager.getDeviceList();"

  • 0

Usually that should just come up as a warning and not an error. However you can put CaptureDeviceInfo as the parameter for the Vector.

ye that is the warning but i assumed thats what causing the error ... but i think i am wrong I jave changed my code again to try and get the whole data

and it comes up with this ... I am just thumbling around with this thing i really no clue ..

Exception in thread "main" java.util.NoSuchElementException

at java.util.Vector.firstElement(Vector.java:485)

at AudioRecorder02.main(AudioRecorder02.java:20)


import java.io.IOException;
import java.util.Vector;
import javax.media.CaptureDeviceInfo;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.cdm.*;
import javax.media.format.AudioFormat;
public class AudioRecorder02 {
static CaptureDeviceInfo di;


public static void main(String args[]) {
Vector deviceList = CaptureDeviceManager.getDeviceList();
di = (CaptureDeviceInfo) deviceList.firstElement();
System.out.println(di);
// Create a Player for the capture device:}
}
[/CODE]

  • 0

ye that is the warning but i assumed thats what causing the error ... but i think i am wrong I jave changed my code again to try and get the whole data

and it comes up with this ... I am just thumbling around with this thing i really no clue ..

Exception in thread "main" java.util.NoSuchElementException

at java.util.Vector.firstElement(Vector.java:485)

at AudioRecorder02.main(AudioRecorder02.java:20)


import java.io.IOException;
import java.util.Vector;
import javax.media.CaptureDeviceInfo;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.cdm.*;
import javax.media.format.AudioFormat;
public class AudioRecorder02 {
static CaptureDeviceInfo di;


public static void main(String args[]) {
Vector deviceList = CaptureDeviceManager.getDeviceList();
di = (CaptureDeviceInfo) deviceList.firstElement();
System.out.println(di);
// Create a Player for the capture device:}
}
[/CODE]

That means the Vector is empty and it couldn't find any devices. Did you use the installer version and run the JMF Registry scanner?

post-13022-0-70343000-1356356208.png

This topic is now closed to further replies.
  • Posts

    • DJI Neo 2 Fly More Combo gets a Prime Day exclusive pricing by Steven Parker DJI reached out to let us know that the DJI Neo 2 Fly More Combo has reached its lowest price ever ahead of Prime Day that starts tomorrow. This Fly More Combo kit adds two extra batteries, and a charge hub so you can charge all three at the same time, or keep two spares fully charged for quick swap and drone flying. (buying link below) Here are some of the important specifications: DJI Neo 2 Fly More Combo Dimensions: 147x171x41mm without DJI Neo 2 Digital Transceiver 167x171x54mm with DJI Neo 2 Digital Transceiver Takeoff Weight: 151 g without DJI Neo 2 Digital Transceiver 160 g with DJI Neo 2 Digital Transceiver Max Ascent Speed: 0.5 m/s (Cine mode) 3 m/s (Normal mode) 5 m/s (Sport Mode) Max Descent Speed: 0.5 m/s (Cine Mode) 3 m/s (Normal Mode) 3 m/s (Sport Mode) Max Horizontal Speed: 8 m/s (Normal Mode) 12 m/s (Sport Mode) 12 m/s (tracking status) Max Takeoff Altitude: 2000 m Max Flight Time: Approx. 19 minutes (approx. 17 minutes with the propeller guards) Each battery allows the drone to perform at least 20 palm takeoff and landing for shoots in succession Max Hovering Time: Approx. 18 minutes (16.5 minutes with the propeller guards) Max Flight Distance: 7 Km Max Wind Speed Resistance: 10.7 m/s (Level 5) Operating Temperature: -10° to 40° C (14° to 104° F) Global Navigation System: GPS + Galileo + BeiDou Hovering Accuracy Range: Vertical: ±0.1 m (with vision positioning) ±0.5 m (with satellite positioning) Horizontal: ±0.3 m (with vision positioning) ±1.5 m (with satellite positioning) Internal Storage: 49 GB Class: C0 (EU) Image Sensor: 1/2-inch CMOS Sensor Lens: FOV: 119.8° Format Equivalent: 16.5 mm Aperture: f/2.2 Focus: 0.7 m to ∞ ISO Range: Photo 100-3200 (Single Auto) 100-12800 (Burst Auto/Timed Auto) 100-12800 (Manual) Video 100-12800 (Auto) 100-12800 (Manual) Shutter Speed: Video: 1/8000-1/30 s Photo: 1/8000-1/10 s Max Image Size: 12 MP Photo 4000×3000 (4:3) 4000×2250 (16:9) Still Photography Modes: Single/Timed Shot Single Shot: 12 MP Timed Shot: 12 MP, 2/3/5/7/10/15/20/30/60 s Photo Format: JPEG Video Resolution: Horizontal Shooting: 4K (4:3*): 3840×2880@60/50/30fps 1080p (4:3*): 1440×1080@60/50/30fps 4K (16:9): 3840×2160@100**/60/50/30fps 1080p (16:9): 1920×1080@100**/60/50/30fps Vertical Shooting: 2.7K (9:16): 1512×2688@60/50/30fps Video features: MP4 Bitrate: 80 Mbps File System: exFAT Color Mode: Normal EIS: Supports RockSteady and turning stabilization off Gimbal: Stabilization: 2-axis mechanical gimbal (tilt, roll) Mechanical Range: Tilt: -125° to 105°, Roll: -43° to 43° Controllable Range: Tilt: -90° to 70° Max Control Speed (tilt): 100°/s Angular Vibration Range: ±0.01° Image Roll Correction: Supports correction of footage recorded on the drone. WiFi: 802.11a/b/g/n/ac/ax Bluetooth: 5.2 Battery: Capacity: 1606 mAh Weight: 46 g Nominal Voltage: 7.16 V Max Charging Voltage: 8.6 V Battery Type: Li-ion Chemical System: LiNiMnCoO2 Energy: 11.5 Wh Charging Temperature: 5° to 40° C (41° to 104° F) Charge time: When Using the Two-Way Charging Hub (65W): Approx. 68 mins to charge three batteries simultaneously from 0% to 100% When Directly Charging the Aircraft Body (15W): Approx. 70 minutes to charge from 0% to 100% (MSRP) Price: $349 As such, you have everything you need to get started right in the box, including the two extra batteries, and a spare set of propellers should things go amiss with the original set of blades on the drone. Oh, the humanity! What's in the box? DJI Neo 2 Aircraft x 1; DJI Neo 2 Intelligent Flight Battery x 3 DJI Neo 2 Two-Way Charging Hub x 1; DJI Neo 2 Spare Propellers (Pair) x 1 DJI Neo 2 Spare Propeller Screw x 4; Screwdriver x 1 DJI Neo 2 Propeller Guard (Pair) x 1; DJI Neo 2 Gimbal Protector x 1 USB-C to USB-C Data Cable x 1 Having never had the chance to mess around with a drone myself, a few more highlights for this drone are listed below: Lightweight & Portable Design - Weighing just 151g and C0 certified, this compact drone features full-coverage propeller guards for safer, worry-free transport and flight. Palm Takeoff & Landing, Gesture Control - Enjoy easy palm takeoff and landing, plus intuitive gesture controls for hands-free operation and seamless flying experiences. Smooth & Reliable Tracking - ActiveTrack keeps your subject in focus, while Apple Watch lets you view live feed, check flight status, or use voice control to adjust tracking. Easy Moment Capture With SelfieShot - Snap memorable moments easily with SelfieShot, allowing quick and convenient selfies anytime with just a simple tap. All-Around Safety & Flexible Flight - Fly confidently with omnidirectional obstacle sensing and enjoy versatile flight for safer, more dynamic aerial adventures. 4K High-Quality Imaging - Capture every moment in stunning detail with 4K resolution, delivering crisp, lifelike photos and videos every time. Good to know DJI also notes on the Amazon sales page that due to platform compatibility issues, the DJI Fly app has been removed from Google Play. Visit the official DJI website to download the user manual and the latest DJI Fly app for a better experience. Which means you will have to sideload it on your Android. Where to buy DJI Neo 2 Fly More Combo for $349 at Amazon US The above price has been communicated to me as a Prime Day exclusive. As an Amazon Associate we earn from qualifying purchases.
    • Upgrade for cheap to Windows 11 Pro or Home Edition digital license by Steven Parker Today's highlighted deal comes via our Apps + Software section of the Neowin Deals store, where you can save up to 94% off on a Microsoft Windows 11 Home, or Pro digital license. Upgrade your computing experience with Windows 11 Pro. This cutting-edge operating system boasts a sleek new design and advanced tools to help you work faster and smarter. From creative projects to gaming and beyond, Windows 11 delivers the power and flexibility you need to achieve your goals. With a focus on productivity, the new features are easy to learn and use, enhancing your workflow and efficiency. Whether you're a student, professional, gamer, or creative, Windows 11 Home has everything you need to take your productivity to the next level. New interface. easier on the eyes & easier to use Biometrics login*.Encrypted authentication & advanced antivirus defenses DirectX 12 Ultimate. Play the latest games with graphics that rival reality. DirectX 12 Ultimate comes ready to maximize your hardware* Screen space. Snap layouts, desktops & seamless redocking Widgets. Stay up-to-date with the content you love & the new you care about Microsoft Teams. Stay in touch with friends and family with Microsoft Teams, which can be seamlessly integrated into your taskbar** Wake & lock. Automatically wake up when you approach and lock when you leave Smart App Control. Provides a layer of security by only permitting apps with good reputations to be installed Windows Studio Effects. Designed with Background Blur, Eye Contact, Voice Focus, & Automatic Framing Touchscreen. For a true mouse-less or keyboard-less experience TPM 2.0. Helps prevent unwanted tampering Windows 11 Pro also includes a number of productivity-focused features, such as the ability to snap multiple windows together and create custom layouts, improved voice typing, and a new, more powerful search experience. Personal and professional users will enjoy a modern and secure computing experience, with improved performance and productivity features to help users get more done. Only on Windows 11 Pro If you require enterprise-oriented features for your daily professional tasks, then Windows 11 Pro is a better option. Set up with a local account (only when set up for work or school) Join Active Directory/Azure AD Hyper-V Windows Sandbox Microsoft Remote Desktop BitLocker device encryption Windows Information Protection Mobile device management (MDM) Group Policy Enterprise State Roaming with Azure Assigned Access Dynamic Provisioning Windows Update for Business Kiosk mode Maximum RAM: 2TB Maximum no. of CPUs: 2 Maximum no. of CPU cores: 128 Good to know This license is for Windows 11 only. It is NOT intended to be used for upgrading Microsoft Office (MSO) included in Parallels Pro. However, it will still work with Parallels Pro and allow you to run Windows applications including MSO, but it DOES NOT include an upgrade MSO itself. It is still compatible with Microsoft Office ONLY if you have a separate license for it. Length of access: lifetime Redemption deadline: redeem your code within 30 days of purchase Access options: desktop Max number of device(s): 1 Version: Windows 11 Pro Updates included Queries on legality of this deal, here A Windows 11 Pro retail license normally costs $199, with Windows 11 Home usually costing $139 but you can pick either one up for just $9.97 for a limited time. For a full description, specs, and license info, click the link below. Get Windows 11 Pro for just $9.97 (was $199) Get Windows 11 Home for just $9.97 (was $139) Although priced in U.S. dollars, this deal is available for digital purchase worldwide. Support queries If you have queries or need support for any of the Neowin Deals, please use the contact form here. Neowin Deals are managed and sold by StackCommerce who represent Neowin on an affiliate basis. Why we post these deals We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. So for those that keep moaning and complaining, be thankful we're still online for you to even do that. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Make a donation to support our day to day running costs Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
    • Why say “Retarded” then? Lol 
    • If you don't care to read what I said, then you prove my point. Maybe written media is beyond your attention span. Titles are not summaries my friend.
  • Recent Achievements

    • Dedicated
      tuben earned a badge
      Dedicated
    • Week One Done
      mnsgroup earned a badge
      Week One Done
    • Conversation Starter
      sumytbe earned a badge
      Conversation Starter
    • One Year In
      B4dM1k3 earned a badge
      One Year In
    • One Year In
      DarkWun earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      519
    2. 2
      +Edouard
      205
    3. 3
      PsYcHoKiLLa
      97
    4. 4
      Michael Scrip
      82
    5. 5
      Steven P.
      68
  • Tell a friend

    Love Neowin? Tell a friend!