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

Source: Internet
Author: User

 

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 context, Uri uri, Map <String, String> headers)

Sets the data source as a content Uri.

Void setDataSource (Context 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. www.2cto.com

:

: 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.

From Yang guifu's column

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.