A convenience method would meet my needs, something like:
AudioInputStream getAudioInputStream(Sequence seq, AudioFormat targetFormat)
throws MidiUnavailableException, UnsupportedAudioFileException;
An AudioSynthesizer interface (of some form) might be useful to select among
multiple software synthesizers, if that should ever happen, and might be useful
as a service provider interface.
Alan
> On Jan 8, 2019, at 7:08 PM, Sergey Bylokhov <[email protected]>
> wrote:
>
> I agree that we can move it to the open, not necessary as-is.
> Or probably we can provide this functionality via Midi/Audio/Systems.
>
> On 07/01/2019 15:41, Alan Snyder wrote:
>> I’m not sure if you are agreeing that it would be useful or arguing against
>> making it public.
>> Alan
>>> On Jan 7, 2019, at 1:39 PM, Sergey Bylokhov <[email protected]>
>>> wrote:
>>>
>>> For sure this is not cancellation of functionality, because it wasn't a
>>> public API.
>>>
>>> Currently it is a implementation detail of SoftMidiAudioFileReader and
>>> it looks useful since it provides the same functionality + the code in
>>> the getAudioInputStream(Sequence) method is not so trivial.
>>>
>>> On 07/01/2019 13:21, Alan Snyder wrote:
>>>> It is probably not a performance issue, but what is the point of
>>>> concealing that obvious functionality?
>>>> Alan
>>>>> On Jan 7, 2019, at 12:55 PM, Sergey Bylokhov <[email protected]>
>>>>> wrote:
>>>>>
>>>>> On 07/01/2019 12:29, Alan Snyder wrote:
>>>>>> Your suggestion works and requires less code, but it is not the best fit
>>>>>> for my use case.
>>>>>
>>>>> Yes, in this case you will need to write data to something like
>>>>> ByteArrayOutputStream, and read it back by AudioSystem.
>>>>> The code will be small comparing to AudioSynthesizer, is the coping of
>>>>> data is a really a big problem and does it play a role in slowness the
>>>>> program?
>>>>>
>>>>>
>>>>>> In my case, I have already constructed a Sequence. To use your
>>>>>> suggestion, I must convert the sequence to MIDI data so that I can
>>>>>> provide it as an InputStream to AudioSystem, where the first thing that
>>>>>> happens is that the data is parsed back into a Sequence.
>>>>>> I see no public way to get a Sequence directly to
>>>>>> SoftMidiAudioFileReader.
>>>>>> Alan
>>>>>>> On Jan 7, 2019, at 11:20 AM, Sergey Bylokhov
>>>>>>> <[email protected]> wrote:
>>>>>>>
>>>>>>> Hi, Alan.
>>>>>>>
>>>>>>> I guess it should work using AudioSystem, which for midi files
>>>>>>> should work on top of com.sun.media.sound.SoftMidiAudioFileReader
>>>>>>>
>>>>>>> On 06/01/2019 18:19, Alan Snyder wrote:
>>>>>>>> As far as I can tell, the ability to synthesize audio into files from
>>>>>>>> MIDI was lost during the great Java modularization due to the failure
>>>>>>>> to export the AudioSynthesizer interface.
>>>>>>>> Is there some reason this has not been fixed?
>>>>>>>> See JDK-8170518 <https://bugs.openjdk.java.net/browse/JDK-8170518>,
>>>>>>>> which I filed in 2016.
>>>>>>>> Alan
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Best regards, Sergey.
>>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards, Sergey.
>>>>>
>>>
>>>
>>> --
>>> Best regards, Sergey.
>>>
>
>
> --
> Best regards, Sergey.
>