When you say no, what should you say: Take playing MIDI on Android as an Example

Source: Internet
Author: User

When you say no, what should you say: Take playing MIDI on Android as an Example

China said "no" to the United States several years ago, and software engineers often said "no" to users and colleagues ".
However, when you say no to others, why?

It is said that when a boy says no, it means no. It is said that when a girl says no, it is recommended that the performance continue.
Meaning. This pitfall has hurt many male. Because, only when she wants you to continue
It means to continue the performance. Otherwise, "no" means "no ". Some girls assume they can understand
This obvious fact: Whether you are welcome to continue.

There is no clear thing in this world. The performance continues. Most of them are male and are expected to continue,
It is usually very soon.

We will not discuss what to say today. Today we will discuss how to explicitly say no.

The above misunderstanding may occur because of the implicit and implicit expression tradition of the eastern nation. I saw a Japanese film.
Some person gave me an idea. The heroine sat down and looked down and said, "although it is good. "

Don't think there are other things to follow. She just stops talking about it. That's how the Japanese speak. She sends
The voice is "although it is good", but what you actually want to convey is all the content that is not mentioned later.

Users and colleagues often misunderstand the project. So how can we accurately convey "no" information?

1. for users

This is simple.

In addition to telling him no, we also need to tell him that it is technically acceptable, but... then we start listing the price:
Time (construction period), funding, and so on.

Then he automatically redirects back. This is similar to a scenario where a girl can't say no.
Yes, "Actually, it doesn't work either, but some conditions need to be added. What I want is simple: a big
The terrace has a swing on it ...... "

A clear rejection means no + you do not have the reason to "do.

2. For colleagues

Clearly tell your colleagues, especially the person assigned to you the task, the way to "Your thoughts are very pig" is,
Tell him why his thoughts are not feasible.

In addition, all his possible questions and all possible corrected ideas should be listed for the sake of simplicity.
And then deny them one by one. Do not look forward to interaction when writing documents or reports. Do not ask him to answer questions,
Use the answer to block all the places where he may open his mouth.

If the enemy is not attacked, I am waiting for it.

The following is an instance story. This is why we need to train and write the experiment report. It records the process.
And data to support your views. No one will be like the president in science fiction movies, because you Qiong
Yao shouted, "Believe me, the Earth will be destroyed." believe you.

What we should do is: Tell the guy that he is not good, then smile at him calmly, and then say exactly and completely
The reason for the failure.

Background:

I asked Niu to develop a program principle in Android to play music with a chord, for example, three degrees. It means that
When the Do, re, mi sound is sent out.

One of the technical solutions is to use PCM Sound mixing, and the other is to play these sounds simultaneously in Midi. Students respectively try
.

After trying for a while, Niu finally found a method to generate the MIDI file.

I propose a new requirement not to write the MIDI file to the file system (internal storage),
Stream in Java is directly sent to the mediaplayer for playback in the memory (RAM.

Said Niu: No.

The story begins.

You can't say no. Of course I can't believe it because you said it. There must be facts.

So Niu sent his code. I learned a bit and found that it was really impossible. Then I wrote the following letter.
Slightly modified.

---- The text of the letter starts from this ----

The "should" mentioned below refers to the recommended Report Writing Method for you. With the information you "should", I can understand what necessary methods you have studied.
This is the correct method to prove your research path.
Alternatively, if you have already told me the "yes" section in the following report, I don't have to read your code.

1. You should provide the midifile source for my reference, because midifile is not written by you and is not part of Java/android;

2. Have you referred to the implementation of the URL after this email? [Http://kevinboone.net/javamidi.html]

3. I mentioned that I do not need to write a MIDI file into the file system,
The original route is as follows:
By Rewriting writetofile, write this method to the file system and assign values to stream. You can also put the Midi content in the vector <byte>;

4. Set mediaplayer. setdatasource () to this vector or stream.

Below is my route for finding a solution.

4.1 mediaplayer requires filedescriptor

[Http://developer.android.com/reference/android/media/mediaplayer.html#pubmethods]
Mediaplayer. setdatasource (filedescriptor FD)
Sets the data source (filedescriptor) to use.

4.2 filedescriptor can be created by fileinputstream/fileoutputstream

[Http://developer.android.com/reference/java/io/filedescriptor.html]
It's possible to get the file descriptor used by some classes (such
Fileinputstream, fileoutputstream, and randomaccessfile), and then
Create new streams that point to the same file descriptor.

[Http://developer.android.com/reference/java/io/fileoutputstream.html]
Fileinputstream. getfd ()
Public final filedescriptor getfd ()
Returns the underlying file descriptor.

At the end of 4.4, my thoughts cannot go any further. The fileinputstream constructor requires files stored in flash.

You should list the following methods and note that mediaplayer does not have other methods setdatasource.

Void setdatasource (string path)
Sets the data source (file-path or HTTP/rtsp url) to use.
Void setdatasource (filedescriptor FD, long offset, long length)
Sets the data source (filedescriptor) to use.
Void setdatasource (filedescriptor FD)
Sets the data source (filedescriptor) to use.
Void setdatasource (context, Uri, Map <string, string> headers)
Sets the data source as a content Uri.
Void setdatasource (context, Uri URI)
Sets the data source as a content Uri.

4.5 then I began to check for other methods. Because stream is used instead of the file system
It should be a very general solution. There is no reason why Android SDK does not support it.

[Http://developer.android.com/reference/android/content/Context.html#getCacheDir ()] discussed this problem,
Play the MIDI files in memory instead of Flash (internal storage.

4.6 The following method I agree to [http://code.google.com/p/android/issues/detail? Id = 739]

: Comment 7 by steveold...@gmail.com, Aug 19,200 8
: From the README written ded with 0.9 SDK.
:
: Unfortunately, the ability to play audio streams from memory (such as via
: Inputstream or reader) will not be possible in Android 1.0. As a workaround, we
: Recommend that developers save media content to SD card and use mediaplayer to play
: From a file URI, or embed a Small HTTP server and play from a URI on localhost (such
: As http: // 127.0.0.1: 4242/something

Yang Note: But early the next morning, I realized that this would not work. The midi is required to read HTTP.
The file already exists. This is contrary to what I originally did not want to write into the file system.

Someone mentioned the same post

: Comment 12 by seeingwi...@gmail.com, May 19,200 9
: Issue now resolved with audiotrack in Android 1.5 (cupcake)

This is the method we mentioned before. As mentioned in [http://developer.android.com/reference/android/media/audiotrack.html,
However, PCM must be used as the buffer instead of Midi.

As the person in the same post replied:

: Comment 22 by Sam. Clegg, SEP 13,201 1
: Is there really still no streaming audio support in Android?
:
: Audiotrack doesn' t help as it only works for PCM samples, not encoded files.

4.7 so far, I proposed to write MIDI from stream and construct mediaplayer from stream. This solution can conclude that it is not feasible.

We can't decide that we can't do it because no one says it doesn't. Instead, we can only use the above analysis.

4.8 we can still use the PCM method to synthesize chords. I suggest you try this method again.

Yang Note: Then the next morning, I regretted it again, because the size of PCM will be much larger than that of MIDI, which is not me.
Hope.

Please use MATLAB for such an experiment:

Yang Note: I have omitted the following experiment here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.