GithubHelp home page GithubHelp logo

ddf / minim Goto Github PK

View Code? Open in Web Editor NEW
664.0 664.0 135.0 134.17 MB

A Java audio library, designed to be used with Processing.

Home Page: http://code.compartmental.net/tools/minim

License: GNU Lesser General Public License v3.0

Java 95.53% CSS 1.89% HTML 2.58%

minim's People

Contributors

artdent avatar corbanbrook avatar ddf avatar hamoid avatar leif81 avatar nodog avatar noncom avatar queengooborg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minim's Issues

problem running example minim buffer.write

i have a problem when running the following example in processing

http://www.erase.net/projects/processing-sc/examples/buffer_write,

in the following part:

void written (Buffer buffer)
{
println("Buffer written to disk");

// HERE IS WHERE THE PROBLEM APPEARS
<<<<< Minim.start(this); >>>>>>>>>

song = Minim.loadFile("/tmp/test.aif");
song.play();
}

it says the function start (buffer_write) does not exist.

I am sorry if the problem doesn;t concern minim, i am pretty new in the programming stuff --

Thank you in advance for any help!!

Possible memory leak in AudioPlayer

I noticed that each time I use AudioPlayer's skip and cue functions, the memory requirement increases and then it never goes down. When I did some profiling, the culprits were the AudioPlayer.cue and and skip functions, with the highest rate of byte[] allocation.

BeatDectect - no way to tell frequency range size when using isOnset and isRange in energy mode

There is currently no way to tell the range of frequency bands when using isOnset and isRange methods in energy mode. Could you please add something like this?:

/**
 * In frequency energy mode this returns the number of frequency bands 
 * currently being used. In sound energy mode this always returns 0.
 * 
 * @return the length of the spect averages array
 */
public int dectectSize()
{
  if (algorithm == FREQ_ENERGY)
  {
    return spect.avgSize();
  }
  else
  {
    return 0;
  }
}

/**
 * Returns the center frequency of the i<sup>th</sup> frequency band.
 * In sound energy mode this always returns 0.
 * 
 * @param i
 *     which detect band you want the center frequency of.
 */
public float getDetectCenterFrequency(int i)
{
  if (algorithm == FREQ_ENERGY)
  {
    return spect.getAverageCenterFrequency(i);
  }
  else
  {
    return 0.0;
  }
}

Crashes in examples.

Minim 2.1.0 Beta all minim-examples with AudioPlayer and addEffect throw some java.lang.NullPointerException on OSX Snow Leopard with Processing 1.2.1

Neither Balance nor Pan available for mono AudioPlayer on Linux?

Processing 3.0b5 (linux64), and am just now trying Minim (2.2.0) because of a myriad of critical problems with the default processing.sound library. I was hoping to be able to pan my mono .wav files, but apparently neither pan nor balance are supported on my Fedora 21 machine with java-1.8.0-openjdk-1.8.0.51-4.b16.fc21.x86_64. Any idea what's wrong?

Summer.removeInput() throws ArrayOutOfBoundsException

We have a single-threaded Processing sketch, where we are dealing with a lot of simultaneous playbacks, number of which is capped to an integer variable. After the queue is overfilled, ugens are being unpatched and sound removed from the queue.

However, sometimes (still mysterious), when trying to run pan.unpatch(out);, ArrayOutOfBoundsException is thrown by AudioOutput's Summer object. It tries to access one position beyond the end of an array (that we assume could've changed WHILE the loop was running).

We looked through our code and couldn't pinpoint the source of the problem (ArrayList that's throwing exception belongs to AudioOutput.Summer) - we don't even use ArrayLists. Thus, I am not really sure whether it's a bug or just us overloading Minim, we thought you'd like to know this anyway.

As a suggestion: maybe make Summer's m_ugens array synchronized or save the array's size explicitly, such that no modifications to it are allowed in such way (during unpatching).

Stack trace:

java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: Index: 11, Size: 11
< ... >
Caused by: java.lang.IndexOutOfBoundsException: Index: 11, Size: 11
    at java.util.ArrayList.rangeCheck(ArrayList.java:635)
    at java.util.ArrayList.get(ArrayList.java:411) <- ArrayList = Summer.m_ugens
    at ddf.minim.ugens.Summer.removeInput(Unknown Source) <- (!!!)
    at ddf.minim.UGen.unpatch(Unknown Source)
    at ddf.minim.UGen.unpatch(Unknown Source)
    at main$Sonify$Chain.dispose(main.java:662)
    at main$Sonify.updateSamples(main.java:779)
    at main$Sonify.play(main.java:794)
    at main.draw(main.java:217)

Our code is available here:
http://github.com/dmitryfd/Zond

The problematic part is in Sonify.pde:44 (we put try/catch around it).

Thanks a lot!

Simplifying Minim interfaces

Was thinking about how we probably could simplify the interfaces in ddf.minim.spi such that there is one interface for reading from an audio stream and one interface for writing to an audio stream. Basically, my main problem with it right now is we have AudioStream, which defines some read methods, and then AudioRecordingStream which defines methods unique to dealing with files, such as play, loop, and setMillisecondPosition. It was originally authored with the intention that the implementation in use would handle creating a thread for playback of an audio file and the core code simply delegated to the interface, but now I think that is pushing more work than necessary into the implementation. If our stream reading is simpler, maybe more like what CoreAudio's ExtAudioFile methods offer, then we only have to write all of the file-specific stuff once (in the core code) and an AudioStream becomes something that may or may not support setting its position, depending on whether the underlying stream is a file or like an internet stream.

Easier use without Processing + Mavenizing

I have created a fork where I:

  1. added the classes to easily create Minim object without Processing (e.g. from Clojure) that provide the basic implementation of the required methods.
  2. mavenized the project and all deps, so that the libraries that you have in the "libraries" folder are now fetched from Maven central repo (the original ones still remain in the folder just in case)

Are you interested in such a pull request?

BTW: uploaded the latest commit currently available (b8afdc1) to Clojars: https://clojars.org/ddf.minim/versions/2.2.1-b8afdc1-SNAPSHOT wow! so far "586 Downloads" - for the previous versions - pretty cool :) People love Minim!

Allow compiling in Android Mode

When I compile any other project in Processing 3.0.1 in windows 10 using an external library it works except for this one. Please make it possible to compile this in Android mode!

Couldn't open the line: line with format PCM_SIGNED 44100.0 Hz ...

Loading stereo .wav files (mono seem to load fine) using...

crowd3[isize] = minim.loadFile(sketchPath(newfilename));

...I get the following two errors for each file:

==== JavaSound Minim Error ====
==== Couldn't open the line: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.

==== JavaSound Minim Error ====
==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian

It seems that this has been a problem in the past, and some folks had solved it:
https://importgeek.wordpress.com/tag/couldnt-open-the-line-line-with-format-pcm_signed-44100-0-hz/
http://forum.processing.org/one/topic/why-can-t-i-play-more-than-one-audiosample.html
processing/processing#1677

But these solutions involve copying libpulse-java.so and pulse-java.jar from openjdk into the processing/java directory. I have jre1.8.0_60-1.8.0_60-fcs.x86_64 installed and it contains no pulse-java.jar file at all.

I am on Fedora 21, Processing 3.0b5, Minim 2.2.1.

Make a realtime InverseFFT example

Given that I'm asked a lot about modifying sound with an FFT and given that the existing example demonstrating the inverse FFT functionality is boring and shitty looking, it'd be pretty sweet to have a realtime interactive example that is doing synthesis using the inverse FFT.

deprecated Carbon audioComponent

When I updated system to OSX 10.11. I got this warning in console:
WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.

Replace setInputMixer and setOutputMixer

These are currently a hack to allow passing in JavaSound Mixer objects. Instead, Minim should instead define its own Mixer class and provide the following methods:

Mixer[] getInputMixers()
Mixer[] getOutputMixers()
void setInputMixer(Mixer)
void setInputMixer(String mixerName)
void setOutputMixer(Mixer)
void setOutputMixer(String mixerName)

Mixer should probably be an interface that has methods for getting the name of the mixer as well as querying if it supports inputs and outputs. We can expand the interface later if it seems useful to do so.

Simplify Controller examples

In anticipation of the FloatControl objects being replaced with something else in the future, the examples for Controller should be reduced to only demonstrating the hasControl method and the set/get methods for each control type.

Exception when quitting sketch while AudioPlayer is playing

Most of the time when quitting a sketch while an AudioPlayer is playing, it will crash with a NullPointerException
screen shot 2013-12-01 at 10 27 38 pm
and the window can only be gotten rid of using the stop button in the PDE. The stack trace is completely unhelpful, but see the attached image for reference. Pretty sure this is OSX only.

Maven or gradle for build?

Any interest in mavenising this project? Would mean that import is easy (import as maven project) into any java ide. Would also remove the need to include jars in the repository (although would still exist in history which is a bit ugly). Another option would be gradle. I could rejig to maven as a pull request if the project owner is interested.

AudioInput does not close properly

The following code:

_minim = new Minim(this);
_in = _minim.getLineIn(Minim.STEREO, 512);
_in.close();
_in = _minim.getLineIn(Minim.STEREO, 512);

results in this error:

"Error acquiring TargetDataLine: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported"

I think this may be a bug in JavaAudio, because I am trying to use the Voce library and the same exact error occurs after trying to close and then reopen an input stream.

A question about the "bufferSize" in loadFile

I'm a fresh user to javasound and minim.
I'm quite confused about the use of this param?
I know it means the size of the AudioBuffer.
But is its unit bit ,byte or something else?
Sorry about my poor English.

Result from Controller.getGain() is ambiguous

If the current gain is 0, the getGain() method would return 0, but if no gain control is available it would also return 0. This would probably also be an issue with getVolume(), getPan() etc.

As I understand it the gain() method is deprecated in favor of these getGain() and setGain(), but there is no hasGainControl() that would tell whether or not gain control is present.

FilePlayer.loop(numLoops) does not work properly

Instead of stopping after the 0th loop, it will jump from loopCount 1 to loopCount -1, at which point it continues to loop indefinitely. This is related to the fact that FilePlayer uses read() on the AudioRecordingStream, rather than read(MultiChannelBuffer).

NumberFormatException in AudioMetaData

When an mp3 has track number information that includes both the track number and the total number of tracks on the album, it appears in the form 6/12 and our parsing code throws a NumberFormatException when it tries to turn that into an int.

how to "listen" for playback finish?

I use plain Java and cannot find many examples.
Browsing through the source code I only found AudioListener that does not seem to do what I need.
Is there a way to be notified for playback events?

minim.getLineIn() in Ubuntu sets java volume to 0

I discovered that calling minim.getLineIn() sets the java volume to 0 (Ubuntu 13.04, Processing 2.0.3, low latency kernel). Any subsequent attempt to play sounds on Processing fail, as the volume stays at 0.

I realized this by trying all the minim examples one by one and keeping PulseAudio Volume Control open, and looking at the Playback tab. Once the volume goes to 0, opening new sketches and running them does not help. The volume stays at 0 and no sound is produced. Using that tool one can manually drag the volume setting back to audible levels.

If it's possible to control that sound volume from code, maybe it would be enough to add a line to all Minim Processing examples to increase the volume at start up, and no further changes to minim or Processing would be required. I tried with setGain() and setVolume() but it did not change the volume displayed in PulseAudio Volume Control.

Error acquiring TargetDataLine

I have downloaded Minim 2.2.0 few days ago, but I had the same problem on the previous beta version.

On the "setInputMixer.pde" example, when I try to change twice or more the audio input, the console return an error :

==== JavaSound Minim Error ====
==== Error acquiring TargetDataLine: line with format PCM_SIGNED 48000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.

And for my program, I need to change multiple times the input. Why it works the first time I change ? And is there a way to fix it ?

Release lineIns

Currently there is no mechanism to release a lineIn. I think it is presumed that it will be destroyed when exiting the app. But with Clojure workflow, when you do not actually ever exit your app even during development, this renders the audio-in capability unusable, since Minim can get the audio line only on the first launch. On subsequent launches the line appears to be busy and Minim gets some unexisting one which is always silent. Thus, a JVM restart is required to recover. However, this is not acceptable for Clojure development workflow.

The methods AudioInput.close() and Minim.stop() do not do this job. Please add explicit dispose methods.

Sampler begin field from Constant

I am using a Constant patched to begin on a Sampler. If I set the constant in setup() and trigger the sample later, everything is fine. However, if I setConstant() and immediately call trigger() on the sampler, the value change is ignored, but will affect a later trigger.

Is this a bug, or should I be doing something to force the constant to apply? I've noticed the same problem with attack.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.